pub struct Base64OpenPGPSignature(String);Expand description
A base64 encoded OpenPGP detached signature.
Wraps a String representing a base64 encoded OpenPGP detached signature
ensuring it consists of valid base64 characters.
§Examples
use std::str::FromStr;
use alpm_types::{Error, Base64OpenPGPSignature};
// Create Base64OpenPGPSignature from a valid base64 String
let sig = Base64OpenPGPSignature::from_str("iHUEABYKAB0WIQRizHP4hOUpV7L92IObeih9mi7GCAUCaBZuVAAKCRCbeih9mi7GCIlMAP9ws/jU4f580ZRQlTQKvUiLbAZOdcB7mQQj83hD1Nc/GwD/WIHhO1/OQkpMERejUrLo3AgVmY3b4/uGhx9XufWEbgE=")?;
// Attempting to create a Base64OpenPGPSignature from an invalid base64 String will fail
assert!(Base64OpenPGPSignature::from_str("!@#$^&*").is_err());
// Format as String
assert_eq!(
format!("{}", sig),
"iHUEABYKAB0WIQRizHP4hOUpV7L92IObeih9mi7GCAUCaBZuVAAKCRCbeih9mi7GCIlMAP9ws/jU4f580ZRQlTQKvUiLbAZOdcB7mQQj83hD1Nc/GwD/WIHhO1/OQkpMERejUrLo3AgVmY3b4/uGhx9XufWEbgE="
);Tuple Fields§
§0: StringImplementations§
Source§impl Base64OpenPGPSignature
impl Base64OpenPGPSignature
Sourcepub fn new(signature: String) -> Result<Self, Error>
pub fn new(signature: String) -> Result<Self, Error>
Creates a new Base64OpenPGPSignature instance.
See Base64OpenPGPSignature::from_str for more information on how the OpenPGP signature
is validated.
Sourcepub fn into_inner(self) -> String
pub fn into_inner(self) -> String
Consumes the Base64OpenPGPSignature and returns the inner String.
Trait Implementations§
Source§impl AsRef<str> for Base64OpenPGPSignature
impl AsRef<str> for Base64OpenPGPSignature
Source§impl Clone for Base64OpenPGPSignature
impl Clone for Base64OpenPGPSignature
Source§fn clone(&self) -> Base64OpenPGPSignature
fn clone(&self) -> Base64OpenPGPSignature
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Base64OpenPGPSignature
impl Debug for Base64OpenPGPSignature
Source§impl<'de> Deserialize<'de> for Base64OpenPGPSignature
impl<'de> Deserialize<'de> for Base64OpenPGPSignature
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 Base64OpenPGPSignature
impl Display for Base64OpenPGPSignature
Source§impl FromStr for Base64OpenPGPSignature
impl FromStr for Base64OpenPGPSignature
Source§fn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Creates a new Base64OpenPGPSignature instance after validating that it follows the
correct format.
A valid OpenPGP signature should consist only of base64 characters (A-Z, a-z, 0-9, +, /) and may include padding characters (=) at the end.
§Errors
Returns an error if the OpenPGP signature is not valid.
Source§impl PartialEq for Base64OpenPGPSignature
impl PartialEq for Base64OpenPGPSignature
Source§impl Serialize for Base64OpenPGPSignature
impl Serialize for Base64OpenPGPSignature
impl Eq for Base64OpenPGPSignature
impl StructuralPartialEq for Base64OpenPGPSignature
Auto Trait Implementations§
impl Freeze for Base64OpenPGPSignature
impl RefUnwindSafe for Base64OpenPGPSignature
impl Send for Base64OpenPGPSignature
impl Sync for Base64OpenPGPSignature
impl Unpin for Base64OpenPGPSignature
impl UnwindSafe for Base64OpenPGPSignature
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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