Struct oo7::dbus::Collection
source · pub struct Collection<'a> { /* private fields */ }
Expand description
A collection allows to store and retrieve items.
The collection can be either in a locked or unlocked state, use
Collection::lock
or Collection::unlock
to lock or unlock it.
Using Collection::search_items
or Collection::items
will return no
items if the collection is locked.
Note
If the collection is deleted using Collection::delete
any future usage
of it API will fail with Error::Deleted
.
Implementations§
source§impl<'a> Collection<'a>
impl<'a> Collection<'a>
sourcepub async fn items(&self) -> Result<Vec<Item<'a>>, Error>
pub async fn items(&self) -> Result<Vec<Item<'a>>, Error>
Retrieve the list of available Item
in the collection.
sourcepub async fn created(&self) -> Result<Duration, Error>
pub async fn created(&self) -> Result<Duration, Error>
The UNIX time when the collection was created.
sourcepub async fn modified(&self) -> Result<Duration, Error>
pub async fn modified(&self) -> Result<Duration, Error>
The UNIX time when the collection was modified.
sourcepub async fn search_items(
&self,
attributes: &impl AsAttributes
) -> Result<Vec<Item<'a>>, Error>
pub async fn search_items( &self, attributes: &impl AsAttributes ) -> Result<Vec<Item<'a>>, Error>
Search for items based on their attributes.
sourcepub async fn create_item(
&self,
label: &str,
attributes: &impl AsAttributes,
secret: impl AsRef<[u8]>,
replace: bool,
content_type: &str
) -> Result<Item<'a>, Error>
pub async fn create_item( &self, label: &str, attributes: &impl AsAttributes, secret: impl AsRef<[u8]>, replace: bool, content_type: &str ) -> Result<Item<'a>, Error>
Create a new item on the collection
§Arguments
label
- A user visible label of the item.attributes
- A map of key/value attributes, used to find the item later.secret
- The secret to store.replace
- Whether to replace the value if theattributes
matches an existingsecret
.content_type
- The content type of the secret, usually something liketext/plain
.
sourcepub fn path(&self) -> &ObjectPath<'_>
pub fn path(&self) -> &ObjectPath<'_>
Returns collection path
sourcepub async fn receive_item_created(
&self
) -> Result<impl Stream<Item = Item<'a>> + '_, Error>
pub async fn receive_item_created( &self ) -> Result<impl Stream<Item = Item<'a>> + '_, Error>
Stream yielding when new items get created
sourcepub async fn receive_item_changed(
&self
) -> Result<impl Stream<Item = Item<'a>> + '_, Error>
pub async fn receive_item_changed( &self ) -> Result<impl Stream<Item = Item<'a>> + '_, Error>
Stream yielding when existing items get changed
sourcepub async fn receive_item_deleted(
&self
) -> Result<impl Stream<Item = OwnedObjectPath>, Error>
pub async fn receive_item_deleted( &self ) -> Result<impl Stream<Item = OwnedObjectPath>, Error>
Stream yielding when existing items get deleted