pub struct InputFile<'src> { /* private fields */ }Implementations§
Source§impl<'src> InputFile<'src>
impl<'src> InputFile<'src>
Sourcepub fn url(url: impl Into<Cow<'src, str>>) -> Self
pub fn url(url: impl Into<Cow<'src, str>>) -> Self
Creates an input file that points to a resource on the internet that Telegram should fetch.
Sourcepub fn file_id(file_id: impl Into<Cow<'src, str>>) -> Self
pub fn file_id(file_id: impl Into<Cow<'src, str>>) -> Self
Creates an input file that points to a file stored by Telegram by its ID
Sourcepub fn memory(vec: Vec<u8>) -> Self
pub fn memory(vec: Vec<u8>) -> Self
Creates an input file that’s represented by bytes in memory. The ownership of the bytes is transferred to the file.
Creates an input file that’s represented by a shared span of bytes in memory.
Sourcepub fn reader(reader: impl AsyncRead + Send + Sync + Unpin + 'static) -> Self
pub fn reader(reader: impl AsyncRead + Send + Sync + Unpin + 'static) -> Self
Creates an input file that’s represented by an async reader
Sourcepub fn text(text: impl Into<Cow<'static, str>>) -> Self
pub fn text(text: impl Into<Cow<'static, str>>) -> Self
Creates an input file from a span of text, either owned or static
Sourcepub fn file_name(self, file_name: impl Into<Cow<'src, str>>) -> Self
pub fn file_name(self, file_name: impl Into<Cow<'src, str>>) -> Self
Sets the name of the input file with which it should be labelled in Telegram
Sourcepub async fn reusable(self) -> Result<Self>
pub async fn reusable(self) -> Result<Self>
Makes the input file reusable by loading a reader into memory, if this input file is backed
by one. After calling this function, the input file can be cloned and
to_future can be called on the containing request.
Should be called if the file could be backed by a reader and the containing request could be sent more than once.