Struct lib_gistit::file::File[][src]

pub struct File { /* fields omitted */ }
Expand description

Represents a gistit file handler and some extra data

Implementations

Opens a file from the given path and returns a File handler.

Errors

Fails with IoError if the file can’t be opened, which probably means the file doesn’t exist, path is invalid, or file handler is blocked.

Creates a new file in your system temp with a random name and writes provided bytes into it. Returns the new File handler

Errors

Fails with IoError if the file can’t be created for some reason. Also if it can’t be written to.

Same as Self::from_bytes_encoded but doesn’t expect encoded bytes

Errors

Fails with IoError if the file can’t be created for some reason. Also if it can’t be written to.

Creates/writes the contents as string to the given file path.

Errors

Fails with IoError if the file can’t be written to.

Set the file name, useful when creating a File using Self::from_bytes. if the File was created using Self::from_path it will use the provided file name.

Returns the file name

Returns the programming language that maps to this file extension

Returns the file size in bytes, not encoded.

Consumes the File encrypting it and returning a new instance of EncryptedFile

Errors

Fails with EncryptionError if something goes wrong during the encryption process. This includes unexpected sizes of the nonce, hashed key. Will also error out if the provided key and nonce is incorrect.

Perform needed checks concurrently, consumes Self and return.

Errors

Fails with FileError if user input isn’t valid

Trait Implementations

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Returns a reference to the original File handler if any.

Returns a reference to the underlying data. Can be encrypted depending on the source

Converts Self into the sendable form of the data

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

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more