Struct etebase::Collection

source ·
pub struct Collection { /* private fields */ }
Expand description

A collection of items

Like Items, collections have two pieces of data associated with them:

  • metadata - contains meta information like name and modification time
  • Content - a buffer containing arbitrary binary data They also have an immutable type and an associated sync token

Implementations§

source§

impl Collection

source

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

Manually verify the integrity of the collection

This is also done automatically by the API

source

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

Set metadata for the collection object

Arguments:
  • meta - the ItemMetadata object to be set for the collection
source

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

Return the ItemMetadata of the collection

Examples found in repository?
examples/etebase_test.rs (line 12)
10
11
12
13
14
fn print_collection(collection: &Collection) {
    println!("UID: {}", &collection.uid());
    println!("Meta: {:?}", &collection.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 collection object from a byte array

Arguments:
  • meta - the metadata for the collection. This needs to be a valid ItemMetadata struct encoded using msgpack.
source

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

Return metadata for the collection object as a byte array

source

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

Set the content of the collection

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

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

Return the content of the collection as a byte array

source

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

Mark the collection as deleted

The collection needs to be uploaded for this to take effect

source

pub fn is_deleted(&self) -> bool

Check whether the collection is marked as deleted

source

pub fn uid(&self) -> &str

The UID of the collection

Examples found in repository?
examples/etebase_test.rs (line 11)
10
11
12
13
14
fn print_collection(collection: &Collection) {
    println!("UID: {}", &collection.uid());
    println!("Meta: {:?}", &collection.meta().unwrap());
    println!();
}
source

pub fn etag(&self) -> &str

The etag of the collection

source

pub fn stoken(&self) -> Option<&str>

The sync token for the collection

The sync token reflects changes to the collection properties or its Items on the server

source

pub fn access_level(&self) -> CollectionAccessLevel

Return the access level of the collection for the current user

source

pub fn item(&self) -> Result<Item>

Return the collection as an Item

source

pub fn collection_type(&self) -> Result<String>

The type of the collection

Trait Implementations§

source§

impl Clone for Collection

source§

fn clone(&self) -> Collection

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§

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