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
impl Placeholder
sourcepub unsafe fn from_raw_handle(handle: OwnedPlaceholderHandle) -> Self
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.
sourcepub fn options() -> OpenOptions
pub fn options() -> OpenOptions
Open options for opening Placeholders.
sourcepub fn open(path: impl AsRef<Path>) -> Result<Self>
pub fn open(path: impl AsRef<Path>) -> Result<Self>
Open the placeholder file/directory with CF_OPEN_FILE_FLAG_NONE
.
sourcepub fn mark_in_sync<'a>(
&mut self,
in_sync: bool,
usn: impl Into<Option<&'a mut Usn>>,
) -> Result<&mut Self>
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?
sourcepub fn mark_pin(
&mut self,
state: PinState,
options: PinOptions,
) -> Result<&mut Self>
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?
sourcepub fn convert_to_placeholder<'a>(
&mut self,
options: ConvertOptions,
usn: impl Into<Option<&'a mut Usn>>,
) -> Result<&mut Self>
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.
sourcepub fn info(&self) -> Result<Option<PlaceholderInfo>>
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.
sourcepub fn fixed_size_info(
&self,
blob_size: usize,
) -> Result<Option<PlaceholderInfo>>
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.
sourcepub fn update<'a>(
&mut self,
options: UpdateOptions<'_>,
usn: impl Into<Option<&'a mut Usn>>,
) -> Result<&mut Self>
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.
sourcepub fn retrieve_data(
&self,
read_type: ReadType,
offset: u64,
buffer: &mut [u8],
) -> Result<u32>
pub fn retrieve_data( &self, read_type: ReadType, offset: u64, buffer: &mut [u8], ) -> Result<u32>
Retrieves data from a placeholder.
sourcepub fn win32_handle(&self) -> Result<ArcWin32Handle>
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.
sourcepub fn inner_handle(&self) -> &OwnedPlaceholderHandle
pub fn inner_handle(&self) -> &OwnedPlaceholderHandle
Returns the owned placeholder handle.
sourcepub fn hydrate(&mut self, range: impl RangeBounds<u64>) -> Result<()>
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.