pub struct Comment(/* private fields */);alloc only.Expand description
SSH key comment (e.g. email address of owner)
Comments may be found in both the binary serialization of PrivateKey as well as the text
serialization of PublicKey.
The binary serialization of PrivateKey stores the comment encoded as an RFC4251
string type which can contain arbitrary binary data and does not necessarily represent valid
UTF-8. To support round trip encoding of such comments.
To support round-trip encoding of such comments, this type also supports arbitrary binary data.
Implementations§
Source§impl Comment
impl Comment
Sourcepub fn as_str(&self) -> Result<&str, Error>
pub fn as_str(&self) -> Result<&str, Error>
Interpret the comment as a UTF-8 string.
§Errors
Returns Error::CharacterEncoding in the event the underlying bytes cannot be interpreted
as valid UTF-8.
Sourcepub fn as_str_lossy(&self) -> &str
pub fn as_str_lossy(&self) -> &str
Interpret the comment as a UTF-8 string.
This is the maximal prefix of the comment which can be interpreted as valid UTF-8.
Trait Implementations§
Source§impl Encode for Comment
impl Encode for Comment
Source§fn encoded_len(&self) -> Result<usize, Error>
fn encoded_len(&self) -> Result<usize, Error>
Source§fn encoded_len_prefixed(&self) -> Result<usize, Error>
fn encoded_len_prefixed(&self) -> Result<usize, Error>
uint32 length prefix. Read moreSource§impl Ord for Comment
impl Ord for Comment
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Comment
impl PartialOrd for Comment
impl Eq for Comment
impl StructuralPartialEq for Comment
Auto Trait Implementations§
impl Freeze for Comment
impl RefUnwindSafe for Comment
impl Send for Comment
impl Sync for Comment
impl Unpin for Comment
impl UnsafeUnpin for Comment
impl UnwindSafe for Comment
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ToHex for T
impl<T> ToHex for T
Source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
self into the result. Lower case
letters are used (e.g. f9b4ca)Source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
self into the result. Upper case
letters are used (e.g. F9B4CA)