Struct etebase::Item

source ·
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

source

pub fn verify(&self) -> Result<bool>

Manually verify the integrity of the item

This is usually done automatically by the API

source

pub fn set_meta<T: MsgPackSerilization>(&mut self, meta: &T) -> Result<()>

Set metadata for the item object

Arguments:
source

pub fn meta(&self) -> Result<ItemMetadata>

Return the ItemMetadata of the item

Examples found in repository?
examples/etebase_test.rs (line 18)
16
17
18
19
20
fn print_item(item: &Item) {
    println!("UID: {}", &item.uid());
    println!("Meta: {:?}", &item.meta().unwrap());
    println!();
}
source

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.

source

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 valid ItemMetadata struct encoded using msgpack.
source

pub fn meta_raw(&self) -> Result<Vec<u8>>

Return metadata for the item object as a byte array

source

pub fn set_content(&mut self, content: &[u8]) -> Result<()>

Set the content of the item

Arguments:
  • content - the content of the item as a byte array
source

pub fn content(&self) -> Result<Vec<u8>>

Return the content of the item as a byte array

source

pub fn delete(&mut self) -> Result<()>

Mark the item as deleted

The item needs to be uploaded for this to take effect

source

pub fn is_deleted(&self) -> bool

Check whether the item is marked as deleted

source

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.

source

pub fn uid(&self) -> &str

The UID of the item

Examples found in repository?
examples/etebase_test.rs (line 17)
16
17
18
19
20
fn print_item(item: &Item) {
    println!("UID: {}", &item.uid());
    println!("Meta: {:?}", &item.meta().unwrap());
    println!();
}
source

pub fn etag(&self) -> &str

The etag of the item

Trait Implementations§

source§

impl Clone for Item

source§

fn clone(&self) -> Item

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere 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> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more