mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-14 11:44:04 +01:00
Add InputFile::{file,url,file_id}
constructors
This commit is contained in:
parent
1df08f02c7
commit
08bf30296c
1 changed files with 18 additions and 0 deletions
|
@ -8,6 +8,24 @@ pub enum InputFile {
|
|||
}
|
||||
|
||||
impl InputFile {
|
||||
pub fn file(path: PathBuf) -> Self {
|
||||
Self::File(path)
|
||||
}
|
||||
|
||||
pub fn url<T>(url: T) -> Self
|
||||
where
|
||||
T: Into<String>
|
||||
{
|
||||
Self::Url(url.into())
|
||||
}
|
||||
|
||||
pub fn file_id(file_id: T) -> Self
|
||||
where
|
||||
T: Into<String>
|
||||
{
|
||||
Self::FileId(fiel_id.into())
|
||||
}
|
||||
|
||||
pub fn as_file(&self) -> Option<&PathBuf> {
|
||||
match self {
|
||||
Self::File(path) => Some(path),
|
||||
|
|
Loading…
Add table
Reference in a new issue