pub fn key_to_cstr(&mut self, s: &[u8]) -> *const u8 {                
        //  If null-terminated, return as pointer.
        if s.last() == Some(&0) { return s.as_ptr() as *const u8; }
        //  Else copy into static key buffer and return pointer to buffer.
        assert!(s.len() < COAP_KEY_SIZE, "big key");  //  Key too long
        self.key_buffer[..s.len()].copy_from_slice(s);
        self.key_buffer[s.len()] = 0;
        self.key_buffer.as_ptr() as *const u8
    }
/// Given a key `s`, return a `*char` pointer that is null-terminated. Used for encoding COAP keys.
/// If `s` is null-terminated, return it as a pointer. Else copy `s` to the static key buffer,
/// append null and return the static key buffer as a pointer.
Given a key `s`, return a `*char` pointer that is null-terminated. Used for encoding COAP keys.
If `s` is null-terminated, return it as a pointer. Else copy `s` to the static key buffer,
append null and return the static key buffer as a pointer.
Given a key ` s ` return a ` * char ` pointer that is null - terminated . Used for encoding COAP keys . If ` s ` is null - terminated return it as a pointer . Else copy ` s ` to the static key buffer append null and return the static key buffer as a pointer .
pub fn key_to_cstr(&mut self, s: &[u8]) -> *const u8 {                
        //  If null-terminated, return as pointer.
        if s.last() == Some(&0) { return s.as_ptr() as *const u8; }
        //  Else copy into static key buffer and return pointer to buffer.
        assert!(s.len() < COAP_KEY_SIZE, "big key");  //  Key too long
        self.key_buffer[..s.len()].copy_from_slice(s);
        self.key_buffer[s.len()] = 0;
        self.key_buffer.as_ptr() as *const u8
    }
pub fn key_to_cstr ( & mut self , s : & [ u8 ] ) -> * const u8 { //  If null-terminated, return as pointer. if s . last ( ) == Some ( & 0 ) { return s . as_ptr ( ) as * const u8 ; } //  Else copy into static key buffer and return pointer to buffer. assert ! ( s len ( ) COAP_KEY_SIZE " " ) ; //  Key too long self . key_buffer [ .. s . len ( ) ] . copy_from_slice ( s ) ; self . key_buffer [ s . len ( ) ] = 0 ; self . key_buffer . as_ptr ( ) as * const u8 }
Given a key `s`, return a `*char` pointer that is null-terminated.
Given a key ` s ` return a ` * char ` pointer that is null - terminated .
&mut self
s
&[u8]
&mut self
s
&[u8]