pub struct ResourceWriteParams {
pub channel: Uri,
pub uri: Uri,
pub data: String,
pub encoding: ContentEncoding,
pub content_type: Option<String>,
pub create_only: Option<bool>,
pub mode: Option<ResourceWriteMode>,
pub position: Option<i64>,
pub if_match: Option<String>,
}Expand description
Writes content to a file on the server’s filesystem.
Binary content (images, etc.) MUST use base64 encoding. Text content MAY
use utf-8 encoding.
If the file does not exist, it is created. If the file already exists, the
effect on existing bytes depends on {@link ResourceWriteParams.mode}:
truncate (default) overwrites from the chosen offset onward, append
preserves all existing bytes and adds data at a position rooted at EOF,
and insert preserves all existing bytes and splices data in at an
offset rooted at the start of the file.
Like all resource* methods, resourceWrite is symmetrical and MAY be
sent in either direction.
Fields§
§channel: UriChannel URI this command targets.
uri: UriTarget file URI on the server filesystem
data: StringContent encoded as a string
encoding: ContentEncodingHow data is encoded
content_type: Option<String>Content type (e.g. "text/plain", "image/png")
create_only: Option<bool>If true, the server MUST fail if the file already exists instead of
overwriting it. Useful for safe creation of new files.
mode: Option<ResourceWriteMode>How data is placed within the target file. Defaults to 'truncate'
(full overwrite) when omitted. See {@link ResourceWriteMode} for the
meaning of each mode and how it interprets {@link position}.
position: Option<i64>Byte offset interpreted according to {@link mode}. Defaults to 0.
truncate: offset from the start of the file at which to truncate before writing.append: bytes back from EOF at which to insertdata.insert: offset from the start of the file at which to splice indata.
if_match: Option<String>Optimistic-concurrency token previously returned by
{@link ResourceResolveResult.etag}. When set, the server MUST fail with
Conflict if the current etag does not match — preventing lost
updates between a resourceResolve and a subsequent resourceWrite.
Trait Implementations§
Source§impl Clone for ResourceWriteParams
impl Clone for ResourceWriteParams
Source§fn clone(&self) -> ResourceWriteParams
fn clone(&self) -> ResourceWriteParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ResourceWriteParams
impl Debug for ResourceWriteParams
Source§impl<'de> Deserialize<'de> for ResourceWriteParams
impl<'de> Deserialize<'de> for ResourceWriteParams
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>,
Source§impl PartialEq for ResourceWriteParams
impl PartialEq for ResourceWriteParams
Source§fn eq(&self, other: &ResourceWriteParams) -> bool
fn eq(&self, other: &ResourceWriteParams) -> bool
self and other values to be equal, and is used by ==.