Struct cloud_filter::placeholder_file::PlaceholderFile

source ·
pub struct PlaceholderFile(/* private fields */);
Expand description

A builder for creating new placeholder files/directories.

Implementations§

source§

impl PlaceholderFile

source

pub fn new(relative_path: impl AsRef<Path>) -> Self

Creates a new [PlaceholderFile][crate::PlaceholderFile].

source

pub fn has_no_children(self) -> Self

Marks this [PlaceholderFile][crate::PlaceholderFile] as having no child placeholders on creation.

If [PopulationType::Full][crate::PopulationType] is specified on registration, this flag will prevent [SyncFilter::fetch_placeholders][crate::SyncFilter::fetch_placeholders] from being called for this placeholder.

Only applicable to placeholder directories.

source

pub fn mark_in_sync(self) -> Self

Marks a placeholder as in sync.

See also SetInSyncState, What does “In-Sync” Mean?

source

pub fn overwrite(self) -> Self

Whether or not to overwrite an existing placeholder.

source

pub fn block_dehydration(self) -> Self

Blocks this placeholder file from being dehydrated.

This flag does not work on directories.

source

pub fn metadata(self, metadata: Metadata) -> Self

The metadata for the [PlaceholderFile][crate::PlaceholderFile].

source

pub fn blob(self, blob: Vec<u8>) -> Self

A buffer of bytes stored with the file that could be accessed through a [Request::file_blob][crate::Request::file_blob] or [FileExit::placeholder_info][crate::ext::FileExt::placeholder_info].

The buffer must not exceed 4KiB.

source

pub fn result(&self) -> Result<Usn>

source

pub fn create<P: AsRef<Path>>(self, parent: impl AsRef<Path>) -> Result<Usn>

Creates a placeholder file/directory on the file system.

The value returned is the final [Usn][crate::Usn] after the placeholder is created.

It is recommended to use this function over [FileExt::to_placeholder][crate::ext::FileExt::to_placeholder] for efficiency purposes. If you need to create multiple placeholders, consider using [BatchCreate][crate::BatchCreate].

If you need to create placeholders from the [SyncFilter::fetch_placeholders][crate::SyncFilter::fetch_placeholders] callback, do not use this method. Instead, use [FetchPlaceholders::pass_with_placeholders][crate::ticket::FetchPlaceholders::pass_with_placeholders].

Trait Implementations§

source§

impl Debug for PlaceholderFile

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for PlaceholderFile

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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, U> Into<U> for T
where 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, U> TryFrom<U> for T
where 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 T
where 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.