pub fn lookup_attribute_id(&self, name_cid: CidBytes) -> Result<Aid, String> {
        let value = Value::from_const_bytes(name_cid);
        match self.lookup_entity(self.database.builtins.attribute_db_attribute_name, value) {
            Some(Eid(id)) => Ok(Aid(id)),
            None => {
                let name_bytes = value.as_bytes(&self.temp_heap).to_vec();
                match String::from_utf8(name_bytes) {
                    Ok(attr_name) => Err(attr_name),
                    Err(..) => Err("<attribute name is invalid UTF-8>".into()),
                }
            }
        }
    }
/// Resolve a named attribute to its attribute id.
///
/// If no such attribute exists, the resolved name is returned, which is
/// helpful for making error messages more actionable.
Resolve a named attribute to its attribute id.
If no such attribute exists, the resolved name is returned, which is
helpful for making error messages more actionable.
Resolve a named attribute to its attribute id . If no such attribute exists the resolved name is returned which is helpful for making error messages more actionable .
pub fn lookup_attribute_id(&self, name_cid: CidBytes) -> Result<Aid, String> {
        let value = Value::from_const_bytes(name_cid);
        match self.lookup_entity(self.database.builtins.attribute_db_attribute_name, value) {
            Some(Eid(id)) => Ok(Aid(id)),
            None => {
                let name_bytes = value.as_bytes(&self.temp_heap).to_vec();
                match String::from_utf8(name_bytes) {
                    Ok(attr_name) => Err(attr_name),
                    Err(..) => Err("<attribute name is invalid UTF-8>".into()),
                }
            }
        }
    }
pub fn lookup_attribute_id ( & self , name_cid : CidBytes ) -> Result < Aid , String > { let value = Value :: from_const_bytes ( name_cid ) ; match self . lookup_entity ( self . database . builtins . attribute_db_attribute_name , value ) { Some ( Eid ( id ) ) => Ok ( Aid ( id ) ) , None => { let name_bytes = value . as_bytes ( & self . temp_heap ) . to_vec ( ) ; match String :: from_utf8 ( name_bytes ) { Ok ( attr_name ) => Err ( attr_name ) , Err ( .. ) => Err ( " " . into ( ) ) , } } } }
Resolve a named attribute to its attribute id.
Resolve a named attribute to its attribute id .
&self
name_cid
CidBytes
&self
name_cid
CidBytes