pub struct MfsWriteOptions {
pub create: bool,
pub parents: bool,
pub truncate: bool,
pub count: Option<u64>,
pub offset: u64,
pub raw_leaves: bool,
pub cid_version: u8,
pub hash: String,
}Expand description
Options for an MFS file write operation.
Controls how data is written to a file in MFS, including whether to create the file, where to write, and how to encode the content.
§Kubo Equivalent
Corresponds to the flags of ipfs files write command.
See core/commands/files.go:filesWriteCmd.
§Example
use ferripfs_network::MfsWriteOptions;
// Create a file if it doesn't exist
let mut opts = MfsWriteOptions::default();
opts.create = true;
opts.parents = true;
assert!(opts.create);
assert!(opts.parents);Fields§
§create: boolCreate the file if it doesn’t exist.
Without this, writing to a non-existent file will fail.
parents: boolCreate parent directories as needed.
Similar to mkdir -p behavior.
truncate: boolTruncate the file before writing.
When true, the file is cleared before new data is written.
count: Option<u64>Maximum number of bytes to write from input.
If None, all input data is written.
offset: u64Byte offset within the file to start writing at.
Allows appending or overwriting at a specific position.
raw_leaves: boolUse raw leaves in the UnixFS DAG.
When true, leaf nodes contain raw data without UnixFS wrapping.
cid_version: u8CID version to use for new blocks (0 or 1).
hash: StringHash algorithm for content addressing.
Default is “sha2-256”.
Implementations§
Source§impl MfsWriteOptions
impl MfsWriteOptions
Sourcepub fn create_new() -> Self
pub fn create_new() -> Self
Create options for creating a new file
Trait Implementations§
Source§impl Clone for MfsWriteOptions
impl Clone for MfsWriteOptions
Source§fn clone(&self) -> MfsWriteOptions
fn clone(&self) -> MfsWriteOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MfsWriteOptions
impl Debug for MfsWriteOptions
Auto Trait Implementations§
impl Freeze for MfsWriteOptions
impl RefUnwindSafe for MfsWriteOptions
impl Send for MfsWriteOptions
impl Sync for MfsWriteOptions
impl Unpin for MfsWriteOptions
impl UnwindSafe for MfsWriteOptions
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more