Skip to main content

ArgAttrs

Struct ArgAttrs 

Source
pub struct ArgAttrs<'a> { /* private fields */ }
Expand description

A borrowed Nix attribute set value.

Obtained from PrimOpArg::as_attrs or PrimOpValue::as_attrs. Provides read access to the attribute set without owning any GC references itself.

Implementations§

Source§

impl<'a> ArgAttrs<'a>

Source

pub fn get(&self, key: &str) -> Result<PrimOpValue<'a>>

Get an attribute by name.

Returns an owned PrimOpValue that holds a GC reference to the attribute’s value. The caller is responsible for the GC reference; PrimOpValue releases it on drop. The value carries the same callback-frame lifetime as this attribute-set wrapper.

§Errors

Returns Error::KeyNotFound if the key does not exist.

Source

pub fn has(&self, key: &str) -> Result<bool>

Check if an attribute exists.

§Errors

Returns an error if the lookup itself fails (not if the key is absent).

Source

pub fn keys(&self) -> Result<Vec<String>>

Return all attribute keys in this set.

§Errors

Returns an error if iteration fails.

Source

pub fn len(&self) -> usize

Return the number of attributes in this set.

Source

pub fn is_empty(&self) -> bool

Return true if the attribute set is empty.

Auto Trait Implementations§

§

impl<'a> Freeze for ArgAttrs<'a>

§

impl<'a> RefUnwindSafe for ArgAttrs<'a>

§

impl<'a> !Send for ArgAttrs<'a>

§

impl<'a> !Sync for ArgAttrs<'a>

§

impl<'a> Unpin for ArgAttrs<'a>

§

impl<'a> UnsafeUnpin for ArgAttrs<'a>

§

impl<'a> UnwindSafe for ArgAttrs<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.