/// Insert the given text into storage and return its id.
///
/// This will reuse old storage slots that already contains the given
/// string.
Insert the given text into storage and return its id.
This will reuse old storage slots that already contains the given
string.
Insert the given text into storage and return its id . This will reuse old storage slots that already contains the given string .
pub fn insert_str(&self, string: &str) -> usize {
        let mut inner = self.inner.borrow_mut();
        if let Some(id) = inner.strings_rev.get(string).copied() {
            return id;
        }
        let id = inner.strings.len();
        let string = string.to_owned();
        inner.strings.push(string.clone());
        inner.strings_rev.insert(string, id);
        id
    }
pub fn insert_str ( & self , string : & str ) -> usize { let mut inner = self . inner . borrow_mut ( ) ; if let Some ( id ) = inner . strings_rev . get ( string ) . copied ( ) { return id ; } let id = inner . strings . len ( ) ; let string = string . to_owned ( ) ; inner . strings . push ( string . clone ( ) ) ; inner . strings_rev . insert ( string , id ) ; id }
Insert the given text into storage and return its id.
Insert the given text into storage and return its id .
&self
string
&str