pub struct SshPublicKey(/* private fields */);Expand description
SSH public key representation using the newtype pattern
This type wraps a string containing a valid SSH public key and provides validation to ensure the key follows basic SSH public key format requirements.
§Example
use torrust_tracker_deployer_lib::adapters::ssh::SshPublicKey;
let key_str = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCw16sai+XVnawp/P/Q23kcXKekygZ6ALmQAyslREo6kbG8s5RScsmbQqOQEcIwnV2Vo88eeWVzX0N0H1dIczRa/ezijBEsGefthzmz9Ix/vM4lodzTPQFtW8c2eYw7ESy12/2x5//UQQ3mxawEWsz5Ri8XuyBEy/Xh7xH/KpoektaocIOt2/WdCe8CvZdMLd7AviGcTdHFWRiOVrmHM1Pd8znqeA3/1KQP/M4Ae5q21oPjchGjVfPkGh/e62Wt+Wo/2lT30AyMO7JHA1tB1W4xANRQkOd1Kb/TrDLXfg0PaHQ+Irmycjp/H4KkcdB06nzYawXMN5csd/5TWKwkb9/vofp6GQNP731U8+JR4cxRfD107KoHroDSJpG2Fanb2PVBkSXAiJl29YrtoP9vUtSIemQCD/aXFtTcpSv7Y16bdp7v+0adCEHwBmodm9GzLL808FpI2ZCzCi+Ae98P3z+yPCxbrnVAahU8AM2NSbrfyH1w2eb4hJ22oPjdd//tBYtkE1TZBw+i3n0vRn04s5BfPRwwj5GISxacTOZm/YWvoE4UU9axtFXOtMUniVKL3ycA+LEfK7C4velOKbluyL8fYYu4pUxHnYOOkYYeRoi2jf3oagbABOpznloPd93wYP3NoUpIdtMZW+iCF0NnZkVLC9lm1FbTcnmrfNzFtGVKCQ== testing@torrust-testing-infra";
let public_key = SshPublicKey::new(key_str).unwrap();
println!("{}", public_key.as_str());Implementations§
Source§impl SshPublicKey
impl SshPublicKey
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Consumes the SshPublicKey and returns the inner string
Trait Implementations§
Source§impl AsRef<str> for SshPublicKey
impl AsRef<str> for SshPublicKey
Source§impl Clone for SshPublicKey
impl Clone for SshPublicKey
Source§impl Debug for SshPublicKey
impl Debug for SshPublicKey
Source§impl<'de> Deserialize<'de> for SshPublicKey
impl<'de> Deserialize<'de> for SshPublicKey
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for SshPublicKey
impl Display for SshPublicKey
impl Eq for SshPublicKey
Source§impl From<SshPublicKey> for String
impl From<SshPublicKey> for String
Source§fn from(key: SshPublicKey) -> String
fn from(key: SshPublicKey) -> String
Converts to this type from the input type.
Source§impl FromStr for SshPublicKey
impl FromStr for SshPublicKey
Source§impl Hash for SshPublicKey
impl Hash for SshPublicKey
Source§impl PartialEq for SshPublicKey
impl PartialEq for SshPublicKey
Source§impl Serialize for SshPublicKey
impl Serialize for SshPublicKey
impl StructuralPartialEq for SshPublicKey
Auto Trait Implementations§
impl Freeze for SshPublicKey
impl RefUnwindSafe for SshPublicKey
impl Send for SshPublicKey
impl Sync for SshPublicKey
impl Unpin for SshPublicKey
impl UnsafeUnpin for SshPublicKey
impl UnwindSafe for SshPublicKey
Blanket Implementations§
Source§impl<T> AsUncased for T
impl<T> AsUncased for T
Source§fn as_uncased(&self) -> &UncasedStr
fn as_uncased(&self) -> &UncasedStr
Convert
self to an UncasedStr.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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<I> IntoResettable<String> for I
impl<I> IntoResettable<String> for I
Source§fn into_resettable(self) -> Resettable<String>
fn into_resettable(self) -> Resettable<String>
Convert to the intended resettable type
Source§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
type Err = !
fn into_result(self) -> Result<T, <T as IntoResult<T>>::Err>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.