Skip to main content

Client

Struct Client 

Source
pub struct Client { /* private fields */ }
Expand description

A client that names the application in its user agent.

Implementations§

Source§

impl Client

Source

pub fn new(version: &str) -> Client

A client for Un-Banished at version.

Source

pub fn image(&self, url: &str) -> Result<Vec<u8>, Error>

A small file from the site, such as a thumbnail (at most 4 MB).

Source

pub fn list( &self, sort: Sort, section: &str, start: u32, count: u32, ) -> Result<Vec<Mod>, Error>

count mods from start of a section ("" for all), in an order.

Source

pub fn search(&self, text: &str) -> Result<Vec<Mod>, Error>

The mods the site’s search finds for text.

Source

pub fn versions(&self, m: &Mod) -> Result<Vec<Version>, Error>

A mod’s versions, newest first.

Source

pub fn download( &self, version: &Version, progress: impl FnMut(u64, Option<u64>), ) -> Result<(String, Vec<u8>), Error>

Download a version: its file name and bytes.

Source

pub fn install( &self, version: &Version, dir: &Path, progress: impl FnMut(u64, Option<u64>), ) -> Result<Vec<PathBuf>, Error>

Install a version into the pack folder: the .pkm packages of the download, written through a temporary file each. Returns the paths written.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.