mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-14 11:44:04 +01:00
Merge pull request #85 from telebofr/input_file_constructors
Add `InputFile::{file,url,file_id}` constructors
This commit is contained in:
commit
6d83450a46
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<T>(file_id: T) -> Self
|
||||
where
|
||||
T: Into<String>
|
||||
{
|
||||
Self::FileId(file_id.into())
|
||||
}
|
||||
|
||||
pub fn as_file(&self) -> Option<&PathBuf> {
|
||||
match self {
|
||||
Self::File(path) => Some(path),
|
||||
|
|
Loading…
Add table
Reference in a new issue