Struct teloxide::types::InputFile

source ·
pub struct InputFile { /* private fields */ }
Expand description

This object represents the contents of a file to be uploaded.

The official docs.

Implementations§

Creates an InputFile from an url.

Notes:

  • When sending by URL the target file must have the correct MIME type (e.g., audio/mpeg for SendAudio, etc.).
  • In SendDocument, sending by URL will currently only work for GIF, PDF and ZIP files.
  • To use SendVoice, the file must have the type audio/ogg and be no more than 1MB in size. 1-20MB voice notes will be sent as files.
  • Other configurations may work but we can’t guarantee that they will.

Creates an InputFile from a file id.

File id can be obtained from

Notes:

  • It is not possible to change the file type when resending by file id. I.e. a video can’t be sent as a photo, a photo can’t be sent as a document, etc.
  • It is not possible to resend thumbnails.
  • Resending a photo by file id will send all of its sizes.
  • file id is unique for each individual bot and can’t be transferred from one bot to another.
  • file id uniquely identifies a file, but a file can have different valid file_ids even for the same bot.

Creates an InputFile from a file path.

Creates an InputFile from a in-memory bytes.

Set the file name for this file.

Creates an InputFile from a in-memory bytes.

Note: in some cases (e.g. sending the same InputFile multiple times) this may read the whole impl AsyncRead into memory.

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
Converts to this type from the input type.
Serialize this value into the given Serde serializer. Read more

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
Unerase this erased pointer. Read more
Available on non-enforce_1_1_0_semantics only.
Whether this implementor has acknowledged the 1.1.0 update to unerase’s documented implementation requirements. Read more
Turn this erasable pointer into an erased pointer. Read more

Returns the argument unchanged.

Converts to this type from a reference to the input type.
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

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