Skip to main content

ViewerConfig

Struct ViewerConfig 

Source
pub struct ViewerConfig {
    pub account: String,
    pub host: IpAddr,
    pub port: u16,
    pub view_distance: u8,
    pub idle: Duration,
    pub token: Option<String>,
    pub replay_dir: Option<PathBuf>,
    pub cache_dir: PathBuf,
    pub client_jar: Option<PathBuf>,
    pub entities: EntityTracking,
}
Expand description

Viewer options.

Fields§

§account: String

Shown on the page (the bot’s name).

§host: IpAddr

Listen address (default 127.0.0.1: put a proxy with access control in front for remote use).

§port: u16

Port (0 = any free port).

§view_distance: u8

Columns sent around the bot: a (2d − 1)² square, 1..=12 (default 8 → 15×15).

§idle: Duration

Stop the server after this long without a page (default 60 s).

§token: Option<String>

Required on every request as Authorization: Bearer <token>, ?token=<token> (the page then keeps it in a cookie) or that cookie. None: no check (fine on 127.0.0.1).

§replay_dir: Option<PathBuf>

Recordings folder (/replays, ?replay=); None: no replays.

§cache_dir: PathBuf

Cache folder for the client jar, extracted textures and built assets (default .cache/ghast-viewer).

§client_jar: Option<PathBuf>

A local vanilla 1.8.9 client jar; None: downloaded from Mojang into the cache.

§entities: EntityTracking

When to track entities, the tab list and skins for the page (default EntityTracking::Always).

Implementations§

Source§

impl ViewerConfig

Source

pub fn new(account: impl Into<String>) -> Self

Defaults for a bot named account.

Source

pub fn port(self, port: u16) -> Self

Sets the port.

Source

pub fn host(self, host: IpAddr) -> Self

Sets the listen address.

Source

pub fn view_distance(self, d: u8) -> Self

Sets the view distance (clamped to 1..=12).

Source

pub fn token(self, token: impl Into<String>) -> Self

Sets the access token.

Source

pub fn replay_dir(self, dir: impl Into<PathBuf>) -> Self

Sets the recordings folder.

Source

pub fn cache_dir(self, dir: impl Into<PathBuf>) -> Self

Sets the cache folder.

Source

pub fn client_jar(self, jar: impl Into<PathBuf>) -> Self

Uses a local client jar.

Source

pub fn entities(self, e: EntityTracking) -> Self

Sets when entities are tracked.

Source

pub fn idle(self, d: Duration) -> Self

Sets the idle timeout.

Trait Implementations§

Source§

impl Clone for ViewerConfig

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ViewerConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Forget for ViewerConfig

§

impl Freeze for ViewerConfig
where *const u8 is !null: Freeze, PhantomData<u8>: Freeze,

§

impl Move for ViewerConfig

§

impl RefUnwindSafe for ViewerConfig

§

impl Send for ViewerConfig
where RawVecInner: Send,

§

impl Sync for ViewerConfig
where RawVecInner: Sync,

§

impl Unpin for ViewerConfig
where *const u8 is !null: Unpin,

§

impl UnsafeUnpin for ViewerConfig

§

impl UnwindSafe for ViewerConfig
where RawVecInner: UnwindSafe,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<A, B, T> HttpServerConnExec<A, B> for T
where B: Body,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V