pub struct Locked<'invoker, 'buffer, B: Buffer> { /* private fields */ }
Expand description

A filesystem component on which methods can be invoked.

This type combines a filesystem address, an Invoker that can be used to make method calls, and a scratch buffer used to perform CBOR encoding and decoding. A value of this type can be created by calling Filesystem::lock, and it can be dropped to return the borrow of the invoker and buffer to the caller so they can be reused for other purposes.

The 'invoker lifetime is the lifetime of the invoker. The 'buffer lifetime is the lifetime of the buffer. The B type is the type of scratch buffer to use.

Implementations

Returns the filesystem’s label, if it has one.

The returned string slice points into, and therefore retains ownership of, the scratch buffer. Consequently, the Locked is consumed and cannot be reused.

Errors

Sets or clears the filesystem’s label and returns the new label, which may be truncated.

The returned string slice points into, and therefore retains ownership of, the scratch buffer. Consequently, the Locked is consumed and cannot be reused.

Errors

Returns whether the filesystem is read-only.

Errors

Returns the total capacity of the filesystem, in bytes.

Errors

Returns the size of all files the filesystem, in bytes.

Errors

Returns whether a file or directory of the given name exists.

Errors

Returns the size of a file.

If the path does not exist or is a directory, zero is returned.

Errors

Returns whether a path refers to an existing directory.

Errors

Returns the last modification time of a file, or the creation time of a directory, in milliseconds since the UNIX epoch.

If the path does not exist, zero is returned. Zero may also be returned on certain filesystems which do not track modification times, such as virtual filesystems.

Errors

Returns the objects contained within a directory.

If the name refers to a file rather than a directory, a single entry is returned specifying the file itself.

The returned string slices point into, and therefore retain ownership of, the scratch buffer. Consequently, the Locked is consumed and cannot be reused.

Errors

Creates a directory and, if missing, its parents.

Errors
  • BadComponent
  • BadFilename
  • Failed is returned if the target directory already exists, or if a directory on the path cannot be created (typically due to lack of space, an intermediate path component being an existing file, or the filesystem being read-only).

Removes a file or directory and its contents.

Errors

Renames a file or directory.

Errors
  • BadComponent
  • BadFilename
  • Failed is returned if the rename fails (typically due to the source path not existing, the destination path existing and being of a different type than the source, the destination being a non-empty directory, or the filesystem being read-only).

Opens a file in write mode.

Errors
  • BadComponent is returned if the filesystem does not exist, is inaccessible, or is not a filesystem.
  • TooManyDescriptors
  • Failed is returned if the path is a directory, the parent of the path is not a directory, or the filesystem is read-only.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.