just_fetch

Trait Fetchable

Source
pub trait Fetchable {
    type Reader: Read;
    type Error;

    // Required method
    fn reader_for(self, f: &mut Fetcher) -> Result<Self::Reader, Self::Error>;
}
Expand description

Something that can be turned into a reader given a fetcher. Example is a URL which can be turned into a reader by sending a GET request, or a file path which can be turned into a reader by just opening the file.

Required Associated Types§

Source

type Reader: Read

The output reader type

Source

type Error

Any potential error that could occur

Required Methods§

Source

fn reader_for(self, f: &mut Fetcher) -> Result<Self::Reader, Self::Error>

Return a reader given a fetcher

Implementations on Foreign Types§

Source§

impl Fetchable for &str

Source§

type Reader = Box<dyn Read>

Source§

type Error = Error

Source§

fn reader_for(self, f: &mut Fetcher) -> Result<Self::Reader, Self::Error>

Source§

impl Fetchable for &Path

Source§

type Reader = Box<dyn Read>

Source§

type Error = Error

Source§

fn reader_for(self, _f: &mut Fetcher) -> Result<Self::Reader, Self::Error>

Source§

impl Fetchable for PathBuf

Source§

type Reader = Box<dyn Read>

Source§

type Error = Error

Source§

fn reader_for(self, f: &mut Fetcher) -> Result<Self::Reader, Self::Error>

Source§

impl Fetchable for Response

Source§

type Reader = Box<dyn Read>

Source§

type Error = Error

Source§

fn reader_for(self, _f: &mut Fetcher) -> Result<Self::Reader, Self::Error>

Source§

impl Fetchable for Url

Source§

type Reader = Box<dyn Read>

Source§

type Error = Error

Source§

fn reader_for(self, f: &mut Fetcher) -> Result<Self::Reader, Self::Error>

Implementors§