pub fn add_string(&mut self, item: &str) -> Result<*mut c_char, NssError> {
        if let Err(ref err) = self.res {
            return Err(err.clone());
        }
        if self.bufpos + item.len() + 1 >= self.buflen {
            self.res = Err(NssError::InsufficientBuffer);
            return Err(NssError::InsufficientBuffer);
        }
        unsafe {
            let buf_cur = self.buffer.offset(self.bufpos as isize);
            copy_nonoverlapping(item.as_ptr(), buf_cur as *mut u8, item.len());
            self.bufpos += item.len() + 1;
            Ok(buf_cur)
        }
    }
/// add a string to the buffer.
add a string to the buffer.
add a string to the buffer .
pub fn add_string(&mut self, item: &str) -> Result<*mut c_char, NssError> {
        if let Err(ref err) = self.res {
            return Err(err.clone());
        }
        if self.bufpos + item.len() + 1 >= self.buflen {
            self.res = Err(NssError::InsufficientBuffer);
            return Err(NssError::InsufficientBuffer);
        }
        unsafe {
            let buf_cur = self.buffer.offset(self.bufpos as isize);
            copy_nonoverlapping(item.as_ptr(), buf_cur as *mut u8, item.len());
            self.bufpos += item.len() + 1;
            Ok(buf_cur)
        }
    }
pub fn add_string ( & mut self , item : & str ) -> Result < * mut c_char , NssError > { if let Err ( ref err ) = self . res { return Err ( err . clone ( ) ) ; } if self . bufpos + item . len ( ) + 1 >= self . buflen { self . res = Err ( NssError :: InsufficientBuffer ) ; return Err ( NssError :: InsufficientBuffer ) ; } unsafe { let buf_cur = self . buffer . offset ( self . bufpos as isize ) ; copy_nonoverlapping ( item . as_ptr ( ) , buf_cur as * mut u8 , item . len ( ) ) ; self . bufpos += item . len ( ) + 1 ; Ok ( buf_cur ) } }
add a string to the buffer.
add a string to the buffer .
&mut self
item
&str