#[repr(transparent)]
pub struct ContentString { /* private fields */ }
Expand description

Holds the notes content in a string and two string slices header and body. This struct is self referencial. It deals with operating system specific handling of newlines. The content of a note is stored as UTF-8 string with one \n character as newline. If present, a Byte Order Mark BOM is removed while reading with new().

Implementations

Trait Implementations

Returns the whole raw content with header and body. Possible \r\n in the input are replaced by \n.

Converts this type into a shared reference of the (usually inferred) input type.

Self referential. The constructor splits the content in header and body.

Cheap access to the note’s header.

Cheap access to the note’s body.

Reads the file at path and stores the content Content. Possible \r\n are replaced by \n. This trait has a default implementation, the empty content. Read more
Constructor that reads a structured document with a YAML header and body. All \r\n are converted to \n if there are any. If not, no memory allocation occurs and the buffer remains untouched. Read more
Writes the note to disk with new_file_path as filename. If new_file_path contains missing directories, they will be created on the fly. Read more
Accesses the whole content with all ---. Contract: The content does not contain any \r\n. If your content contains \r\n use the from_string_with_cr() constructor. Read more
True if the header and body is empty.
Helper function that splits the content into header and body. The header, if present, is trimmed (trim()), the body is kept as it is. Any BOM (byte order mark) at the beginning is ignored. Read more
Formats the value using the given formatter. Read more

Default is the empty string.

Delegates the printing to Display for ContentRef.

Formats the value using the given formatter. Read more
Executes the destructor for this type. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Convert self to an [UncasedStr].
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

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

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.