pub enum ResourceWriteMode {
Truncate,
Append,
Insert,
}Expand description
How {@link ResourceWriteParams.data} is placed within the target file.
Each mode interprets {@link ResourceWriteParams.position} differently:
truncate(default): rooted at the start of the file. The file is truncated atposition(0 by default) anddatais written from that offset, so the resulting file isexisting[0..position] + data. Withpositionomitted this is a full overwrite.append: rooted at the end of the file.positioncounts bytes backwards from EOF, soposition: 0(the default) writes at EOF — POSIX append — andposition: 5insertsdata5 bytes before the current EOF, shifting those trailing 5 bytes after the inserted region. The server MUST evaluate the effective EOF and write atomically with respect to other appenders so concurrentappendwrites do not clobber each other.insert: rooted at the start of the file.position(0 by default) is the byte offset at whichdatais spliced in; bytes at or afterpositionare shifted right bydata.length.insertalways grows the file — usetruncateto overwrite bytes in place.
Variants§
Trait Implementations§
Source§impl Clone for ResourceWriteMode
impl Clone for ResourceWriteMode
Source§fn clone(&self) -> ResourceWriteMode
fn clone(&self) -> ResourceWriteMode
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ResourceWriteMode
Source§impl Debug for ResourceWriteMode
impl Debug for ResourceWriteMode
Source§impl<'de> Deserialize<'de> for ResourceWriteMode
impl<'de> Deserialize<'de> for ResourceWriteMode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for ResourceWriteMode
Source§impl Hash for ResourceWriteMode
impl Hash for ResourceWriteMode
Source§impl PartialEq for ResourceWriteMode
impl PartialEq for ResourceWriteMode
Source§fn eq(&self, other: &ResourceWriteMode) -> bool
fn eq(&self, other: &ResourceWriteMode) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ResourceWriteMode
impl Serialize for ResourceWriteMode
impl StructuralPartialEq for ResourceWriteMode
Auto Trait Implementations§
impl Freeze for ResourceWriteMode
impl RefUnwindSafe for ResourceWriteMode
impl Send for ResourceWriteMode
impl Sync for ResourceWriteMode
impl Unpin for ResourceWriteMode
impl UnsafeUnpin for ResourceWriteMode
impl UnwindSafe for ResourceWriteMode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more