Struct cloud_filter::placeholder::Placeholder

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

A struct to perform various operations on a placeholder(or regular) file/directory.

Implementations§

source§

impl Placeholder

source

pub unsafe fn from_raw_handle(handle: OwnedPlaceholderHandle) -> Self

Create a placeholder from a raw handle.

§Safety

The passed handle must be a valid protected handle or win32 handle.

source

pub fn options() -> OpenOptions

Open options for opening Placeholders.

source

pub fn open(path: impl AsRef<Path>) -> Result<Self>

Open the placeholder file/directory with CF_OPEN_FILE_FLAG_NONE.

source

pub fn mark_in_sync<'a>( &mut self, in_sync: bool, usn: impl Into<Option<&'a mut Usn>>, ) -> Result<&mut Self>

Marks a placeholder as in sync or not.

If the passed Usn is outdated, the call will fail, otherwise the Usn will be updated.

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

source

pub fn mark_pin( &mut self, state: PinState, options: PinOptions, ) -> Result<&mut Self>

Sets the pin state of the placeholder.

See also CfSetPinState, What does “Pinned” Mean?

source

pub fn convert_to_placeholder<'a>( &mut self, options: ConvertOptions, usn: impl Into<Option<&'a mut Usn>>, ) -> Result<&mut Self>

Converts a file to a placeholder file.

If the passed Usn is outdated, the call will fail, otherwise the Usn will be updated.

See also CfConvertToPlaceholder.

source

pub fn info(&self) -> Result<Option<PlaceholderInfo>>

Gets various characteristics of the placeholder.

Returns None if the handle not points to a placeholder.

If the placeholder blob size is known, use fixed_size_info instead.

source

pub fn fixed_size_info( &self, blob_size: usize, ) -> Result<Option<PlaceholderInfo>>

Gets various characteristics of the placeholder.

If the blob_size not matches the actual size of the blob, the call will returns HRESULT_FROM_WIN32(ERROR_MORE_DATA). Returns None if the handle not points to a placeholder.

source

pub fn update<'a>( &mut self, options: UpdateOptions<'_>, usn: impl Into<Option<&'a mut Usn>>, ) -> Result<&mut Self>

Updates various characteristics of a placeholder.

See also CfUpdatePlaceholder.

source

pub fn retrieve_data( &self, read_type: ReadType, offset: u64, buffer: &mut [u8], ) -> Result<u32>

Retrieves data from a placeholder.

source

pub fn win32_handle(&self) -> Result<ArcWin32Handle>

Returns the Win32 handle from protected handle.

Returns Err(E_HANDLE) if the OwnedPlaceholderHandle::handle_type is not PlaceholderHandleType::CfApi.

source

pub fn inner_handle(&self) -> &OwnedPlaceholderHandle

Returns the owned placeholder handle.

source

pub fn hydrate(&mut self, range: impl RangeBounds<u64>) -> Result<()>

Hydrates a placeholder file by ensuring that the specified byte range is present on-disk in the placeholder. This is valid for files only.

§Panics

Panics if the start bound is greater than i64::MAX or the end bound sub start bound is greater than i64::MAX.

See also CfHydratePlaceholder and discussion.

Trait Implementations§

source§

impl Debug for Placeholder

source§

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

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

impl From<File> for Placeholder

source§

fn from(file: File) -> Self

Converts to this type from the input type.
source§

impl TryFrom<Placeholder> for File

§

type Error = Error

The type returned in the event of a conversion error.
source§

fn try_from(placeholder: Placeholder) -> Result<Self>

Performs the conversion.

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.