pub struct Item { /* private fields */ }
Expand description
Items belong to collections and are where data is stored
Items have two pieces of data associated with them:
- metadata - contains meta information like name and modification time
- Content - a buffer containing arbitrary binary data.
Implementations§
source§impl Item
impl Item
sourcepub fn verify(&self) -> Result<bool>
pub fn verify(&self) -> Result<bool>
Manually verify the integrity of the item
This is usually done automatically by the API
sourcepub fn meta(&self) -> Result<ItemMetadata>
pub fn meta(&self) -> Result<ItemMetadata>
Return the ItemMetadata
of the item
sourcepub fn meta_generic<T: MsgPackSerilization>(&self) -> Result<T::Output>
pub fn meta_generic<T: MsgPackSerilization>(&self) -> Result<T::Output>
Return the ItemMetadata
of the collection deserializing using a generic metadata object
The metadata object needs to implement the MsgPackSerilization
trait.
sourcepub fn set_meta_raw(&mut self, meta: &[u8]) -> Result<()>
pub fn set_meta_raw(&mut self, meta: &[u8]) -> Result<()>
Set metadata for the item object from a byte array
Arguments:
meta
- the metadata for the item. This needs to be a validItemMetadata
struct encoded usingmsgpack
.
sourcepub fn set_content(&mut self, content: &[u8]) -> Result<()>
pub fn set_content(&mut self, content: &[u8]) -> Result<()>
sourcepub fn delete(&mut self) -> Result<()>
pub fn delete(&mut self) -> Result<()>
Mark the item as deleted
The item needs to be uploaded for this to take effect
sourcepub fn is_deleted(&self) -> bool
pub fn is_deleted(&self) -> bool
Check whether the item is marked as deleted
sourcepub fn is_missing_content(&self) -> bool
pub fn is_missing_content(&self) -> bool
Check whether the item is missing content and should be downloaded
If it is, the content should be downloaded with ItemManager::download_content
.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Item
impl Send for Item
impl !Sync for Item
impl Unpin for Item
impl UnwindSafe for Item
Blanket Implementations§
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