/// Insert the given text into storage and return its id.
///
/// This will reuse old storage slots that already contains the given
/// byte string.
Insert the given text into storage and return its id.
This will reuse old storage slots that already contains the given
byte string.
Insert the given text into storage and return its id . This will reuse old storage slots that already contains the given byte string .
pub fn insert_byte_string(&self, bytes: &[u8]) -> usize {
        let mut inner = self.inner.borrow_mut();
        if let Some(id) = inner.byte_strings_rev.get(bytes).copied() {
            return id;
        }
        let id = inner.byte_strings.len();
        inner.byte_strings.push(bytes.to_vec());
        inner.byte_strings_rev.insert(bytes.to_vec(), id);
        id
    }
pub fn insert_byte_string ( & self , bytes : & [ u8 ] ) -> usize { let mut inner = self . inner . borrow_mut ( ) ; if let Some ( id ) = inner . byte_strings_rev . get ( bytes ) . copied ( ) { return id ; } let id = inner . byte_strings . len ( ) ; inner . byte_strings . push ( bytes . to_vec ( ) ) ; inner . byte_strings_rev . insert ( bytes . to_vec ( ) , id ) ; id }
Insert the given text into storage and return its id.
Insert the given text into storage and return its id .
&self
bytes
&[u8]