[][src]Struct dogear::ItemBuilder

pub struct ItemBuilder<'b>(_, _);

Adds an item with content and structure to a tree builder.

Methods

impl<'b> ItemBuilder<'b>[src]

pub fn content<'c>(&'c mut self, content: Content) -> &'c mut ItemBuilder<'b>[src]

Sets content info for an item that hasn't been uploaded or merged yet. We'll try to dedupe local items with content info to remotely changed items with similar contents and different GUIDs.

pub fn by_children(self, parent_guid: &Guid) -> Result<&'b mut Builder>[src]

Records a parent_guid from the item's parent's children. See ParentBuilder::by_children.

pub fn by_parent_guid(self, parent_guid: Guid) -> Result<&'b mut Builder>[src]

Records a parent_guid from the item's parentid. See ParentBuilder::by_parent_guid.

pub fn by_structure(self, parent_guid: &Guid) -> Result<&'b mut Builder>[src]

Records a parent_guid from a valid tree structure. This is for callers who already know their structure is consistent, like Store::fetch_local_tree() on Desktop, and std::convert::TryInto<Tree> in the tests.

Both the item and parent_guid must exist, and the parent_guid must refer to a folder.

by_structure(parent_guid) is logically the same as:

builder.parent_for(&child_guid)
    .by_children(&parent_guid)?
.parent_for(&child_guid)
    .by_parent_guid(parent_guid)?;

...But more convenient. It's also more efficient, because it avoids multiple lookups for the item and parent, as well as an extra heap allocation to store the parents.

Auto Trait Implementations

impl<'b> Sync for ItemBuilder<'b>

impl<'b> Send for ItemBuilder<'b>

impl<'b> Unpin for ItemBuilder<'b>

impl<'b> RefUnwindSafe for ItemBuilder<'b>

impl<'b> !UnwindSafe for ItemBuilder<'b>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]