Struct patch::File

source ·
pub struct File<'a> {
    pub path: Cow<'a, str>,
    pub meta: Option<FileMetadata<'a>>,
}
Expand description

The file path and any additional info of either the old file or the new file

Fields§

§path: Cow<'a, str>

The parsed path or file name of the file

Avoids allocation if at all possible. Only allocates if the file path is a quoted string literal. String literals are necessary in some cases, for example if the file path has spaces in it. These literals can contain escaped characters which are initially seen as groups of two characters by the parser (e.g. ‘\’ + ‘n’). A newly allocated string is used to unescape those characters (e.g. “\n” -> ‘\n’).

Note: While this string is typically a file path, this library makes no attempt to verify the format of that path. That means that this field can potentially be any string. You should verify it before doing anything that may be security-critical.

§meta: Option<FileMetadata<'a>>

Any additional information provided with the file path

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

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 resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String. Read more
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.