pub struct InputFile { /* private fields */ }
Expand description
This object represents the contents of a file to be uploaded.
Implementations§
source§impl InputFile
impl InputFile
sourcepub fn url(url: Url) -> Self
pub fn url(url: Url) -> Self
Creates an InputFile
from an url.
Notes:
- When sending by URL the target file must have the correct MIME type
(e.g.,
audio/mpeg
forSendAudio
, etc.). - In
SendDocument
, sending by URL will currently only work forGIF
,PDF
andZIP
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.
sourcepub fn file_id(file_id: impl Into<String>) -> Self
pub fn file_id(file_id: impl Into<String>) -> Self
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.
Trait Implementations§
source§impl From<InputMedia> for InputFile
impl From<InputMedia> for InputFile
source§fn from(media: InputMedia) -> InputFile
fn from(media: InputMedia) -> InputFile
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for InputFile
impl Send for InputFile
impl Sync for InputFile
impl Unpin for InputFile
impl !UnwindSafe for InputFile
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more