grammers_client/types/downloadable.rs
1// Copyright 2020 - developers of the `grammers` project.
2//
3// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
6// option. This file may not be copied, modified, or distributed
7// except according to those terms.
8use grammers_tl_types as tl;
9
10pub trait Downloadable {
11 fn to_raw_input_location(&self) -> Option<tl::enums::InputFileLocation>;
12
13 // Data for tiny thumbnails comes inline, so there is no need to download anything.
14 fn to_data(&self) -> Option<Vec<u8>> {
15 None
16 }
17
18 // Size, if known, to parallelize large downloads.
19 fn size(&self) -> Option<usize> {
20 None
21 }
22}