pub enum InputFile {
Reference(String),
Memory {
attachment_name: String,
file_name: String,
data: Arc<[u8]>,
},
Path {
attachment_name: String,
file_name: String,
path: PathBuf,
},
Url {
attachment_name: String,
file_name: String,
url: String,
headers: BTreeMap<String, String>,
timeout: Duration,
},
}Expand description
A Telegram file reference or a new in-memory upload.
Variants§
Implementations§
Source§impl InputFile
impl InputFile
pub fn reference(value: impl Into<String>) -> Self
pub fn bytes(file_name: impl Into<String>, data: impl Into<Vec<u8>>) -> Self
Sourcepub fn named_bytes(
attachment_name: impl Into<String>,
file_name: impl Into<String>,
data: impl Into<Vec<u8>>,
) -> Self
pub fn named_bytes( attachment_name: impl Into<String>, file_name: impl Into<String>, data: impl Into<Vec<u8>>, ) -> Self
Creates an upload with a distinct multipart attachment id and file name.
Sourcepub fn path(path: impl Into<PathBuf>) -> Self
pub fn path(path: impl Into<PathBuf>) -> Self
Reads a local file only when the Bot API request is executed.
pub fn named_path( attachment_name: impl Into<String>, file_name: impl Into<String>, path: impl AsRef<Path>, ) -> Self
Sourcepub fn url(file_name: impl Into<String>, url: impl Into<String>) -> Self
pub fn url(file_name: impl Into<String>, url: impl Into<String>) -> Self
Downloads a file through the bot’s configured HTTP client when the multipart request is executed.
pub fn named_url( attachment_name: impl Into<String>, file_name: impl Into<String>, url: impl Into<String>, ) -> Self
pub fn headers(self, value: BTreeMap<String, String>) -> Self
pub fn timeout(self, value: Duration) -> Self
pub fn attachment_name(&self) -> Option<&str>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for InputFile
impl<'de> Deserialize<'de> for InputFile
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for InputFile
impl StructuralPartialEq for InputFile
Auto Trait Implementations§
impl Freeze for InputFile
impl RefUnwindSafe for InputFile
impl Send for InputFile
impl Sync for InputFile
impl Unpin for InputFile
impl UnsafeUnpin 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