pub struct Value { /* private fields */ }
Expand description
A value containing a secret
A #SecretValue contains a password or other secret value.
Use get()
to get the actual secret data, such as a password.
The secret data is not necessarily null-terminated, unless the content type
is “text/plain”.
Each #SecretValue has a content type. For passwords, this is text/plain
.
Use content_type()
to look at the content type.
#SecretValue is reference counted and immutable. The secret data is only
freed when all references have been released via Value::unref()
.
Implementations§
source§impl Value
impl Value
sourcepub fn as_ptr(&self) -> *mut SecretValue
pub fn as_ptr(&self) -> *mut SecretValue
Return the inner pointer to the underlying C value.
sourcepub unsafe fn from_glib_ptr_borrow<'a>(
ptr: *const *const SecretValue
) -> &'a Self
pub unsafe fn from_glib_ptr_borrow<'a>( ptr: *const *const SecretValue ) -> &'a Self
Borrows the underlying C value.
source§impl Value
impl Value
sourcepub fn new(secret: &str, content_type: &str) -> Value
pub fn new(secret: &str, content_type: &str) -> Value
Create a #SecretValue for the secret data passed in.
The secret data is copied into non-pageable ‘secure’ memory.
If the length is less than zero, then @secret is assumed to be null-terminated.
§secret
the secret data
§length
the length of the data
§content_type
the content type of the data
§Returns
the new #SecretValue
sourcepub fn get(&self) -> Vec<u8>
pub fn get(&self) -> Vec<u8>
Get the secret data in the #SecretValue.
The value is not necessarily null-terminated unless it was created with
Value::new()
or a null-terminated string was passed to
Value::new_full()
.
§Returns
the secret data
sourcepub fn content_type(&self) -> GString
pub fn content_type(&self) -> GString
sourcepub fn text(&self) -> Option<GString>
pub fn text(&self) -> Option<GString>
Get the secret data in the #SecretValue if it contains a textual value.
The content type must be text/plain
.
§Returns
the content type
sourcepub fn unref_to_password(&self) -> GString
pub fn unref_to_password(&self) -> GString
Trait Implementations§
source§impl HasParamSpec for Value
impl HasParamSpec for Value
source§impl Ord for Value
impl Ord for Value
source§impl PartialEq for Value
impl PartialEq for Value
source§impl PartialOrd for Value
impl PartialOrd for Value
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl StaticType for Value
impl StaticType for Value
source§fn static_type() -> Type
fn static_type() -> Type
Self
.