Skip to main content

FileNode

Struct FileNode 

Source
#[non_exhaustive]
pub struct FileNode {
Show 18 fields pub id: Id, pub parent_id: Option<Id>, pub node_type: Option<NodeType>, pub blob_id: Option<Id>, pub target: Option<Vec<String>>, pub size: Option<u64>, pub name: String, pub media_type: Option<String>, pub created: Option<UTCDate>, pub modified: Option<UTCDate>, pub accessed: Option<UTCDate>, pub changed: Option<UTCDate>, pub executable: Option<bool>, pub is_subscribed: Option<bool>, pub my_rights: Option<FilesRights>, pub share_with: Option<HashMap<Id, FilesRights>>, pub role: Option<NodeRole>, pub extra: Map<String, Value>,
}
Expand description

A JMAP FileNode object (draft-ietf-jmap-filenode-13 §3.1).

§Nullable vs optional fields

Several fields are required-but-nullable: they MUST appear in the wire JSON even when their value is null. These use Option<T> with NO skip_serializing_if, so serde emits "field":null.

Other fields are truly optional: absent from the wire when not set by the client or server. These use #[serde(skip_serializing_if = "Option::is_none")].

Nullable (must appear as null)Optional (absent when None)
parent_id, blob_id, target, size, media_type, share_with, rolenode_type, created, modified, accessed, changed, executable, is_subscribed, my_rights

§modified and accessed semantics

Both are client-managed. The server does NOT automatically update them on change. Setting either to null in an update (None after deserialization) signals the server to reset it to the current time. This differs from changed, which the server sets automatically and clients cannot set.

§share_with visibility

shareWith is null when the requesting user lacks myRights.mayShare or the node is not shared with anyone.

§blob_id lifetime guarantee

A blob referenced by a FileNode MUST NOT be garbage-collected by the server while the FileNode exists (§3.1). The server backend must enforce this invariant.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§id: Id

Server-assigned immutable identifier.

§parent_id: Option<Id>

Id of the parent node, or null if this is a top-level node.

Required-and-nullable: always present in wire JSON (as null or an Id string).

§node_type: Option<NodeType>

The type of node. Immutable after creation.

If absent on creation the server infers: "file" if blobId is non-null, "symlink" if target is non-null, "directory" otherwise.

§blob_id: Option<Id>

The blobId for the file content.

Required-and-nullable: always present in wire JSON. MUST be non-null for file nodes, null for directory and symlink nodes.

§target: Option<Vec<String>>

Symlink target as an array of path elements.

Required-and-nullable: always present in wire JSON. MUST be non-null for symlink nodes, null for file and directory nodes.

§size: Option<u64>

Size in bytes of the associated blob data (server-set).

Required-and-nullable: always present in wire JSON. MUST be null for directory and symlink nodes, non-null for file nodes.

§name: String

User-visible name for the FileNode. Net-Unicode, at least 1 character.

§media_type: Option<String>

The media type (IANA) of the FileNode.

Required-and-nullable: always present in wire JSON. Wire field name is literally "type" (a Rust keyword). MUST be non-null for file nodes, null for directory and symlink nodes.

§created: Option<UTCDate>

The date the node was created.

Default: current server time. Absent from wire when None.

Uses the UTCDate newtype to make the wire-format constraint (RFC 8620 §1.4: 20-character UTCDateTime string) explicit at the type level. JSON wire format is unchanged because UTCDate is a transparent newtype around String.

§modified: Option<UTCDate>

The date the node was last updated, client-managed.

Setting to null in an update signals the server to reset to the current time. The server does NOT auto-update this value. Absent from wire when None.

See created for the typing rationale.

§accessed: Option<UTCDate>

The date the node was last accessed, client-managed.

Setting to null in an update signals the server to reset to the current time. The server does NOT auto-update this value. Absent from wire when None.

See created for the typing rationale.

§changed: Option<UTCDate>

The date the server last recorded a change to any property (server-set).

Automatically updated on every mutation. Not settable by clients. Absent from wire when None.

Uses the UTCDate newtype to make the wire-format constraint (RFC 8620 §1.4: 20-character UTCDateTime string) explicit at the type level. JSON wire format is unchanged because UTCDate is a #[serde(transparent)] newtype around String.

§executable: Option<bool>

If true, the node should be treated as executable. Default: false.

Absent from wire when None.

§is_subscribed: Option<bool>

Whether the current user is subscribed to this node. Default: true.

Per-user property. Absent from wire when None.

§my_rights: Option<FilesRights>

ACL rights the authenticated user holds for this node (server-set).

Absent from wire when None.

§share_with: Option<HashMap<Id, FilesRights>>

Map of userId → rights for users this node is shared with.

Required-and-nullable: always present in wire JSON. null when the requesting user lacks myRights.mayShare or the node is not shared.

§role: Option<NodeRole>

Special role identifying this directory’s purpose.

Required-and-nullable (draft §3.1 type: String|null): always present in wire JSON; serializes as null when unset. MUST be null for file nodes.

§extra: Map<String, Value>

Catch-all for vendor / site / private extension fields not covered by the typed fields above. Preserves unknown fields across deserialize/serialize round-trip per workspace extras-preservation policy (see workspace AGENTS.md).

Trait Implementations§

Source§

impl Clone for FileNode

Source§

fn clone(&self) -> FileNode

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FileNode

Source§

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

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

impl<'de> Deserialize<'de> for FileNode

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl GetObject for FileNode

Source§

impl JmapObject for FileNode

Source§

const TYPE_NAME: &'static str = "FileNode"

The JMAP type name string (e.g. "Email", "Mailbox", "Chat").
Source§

type Property = FileNodeProperty

The property selector enum for this type (server-side only, no serde).
Source§

impl PartialEq for FileNode

Source§

fn eq(&self, other: &FileNode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl QueryObject for FileNode

Source§

type Filter = FileNodeFilterCondition

The filter condition type. Read more
Source§

type Comparator = Value

The comparator type for sort operations.
Source§

impl Serialize for FileNode

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl SetObject for FileNode

Source§

type Patch = PatchObject

The patch type for update operations. Read more
Source§

impl StructuralPartialEq for FileNode

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

Source§

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.