Skip to main content

Client

Struct Client 

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

A client for setting one server’s own anchor watch.

Built from what crate::stream::Connection and crate::access::request_access already needed, the same shape crate::resources::Client already takes for the identical reason.

Implementations§

Source§

impl Client

Source

pub fn new(http_base: String, trust: Trust, token: Option<String>) -> Self

A client for the server at http_base, using trust to decide which server may answer and token (once one exists) to authenticate the write.

Source

pub fn set_anchor( &self, position: Position, max_radius_m: f64, ) -> Result<(), ClientError>

Sets the anchor position and swing radius, starting the plugin’s own drift monitoring once both are known.

Two separate PUTs – there is no combined endpoint – sent radius first. Either order leaves the plugin watching once both are set, but sending the position last means the plugin’s own “radius already known” branch starts monitoring, rather than racing whichever call happens to land second.

§Errors

If there is no token – a write always needs one – if the server cannot be reached, or if it refuses the write.

Source

pub fn clear_anchor(&self) -> Result<(), ClientError>

Raises the anchor. Clears navigation.anchor.position, which the plugin answers by nulling maxRadius (and everything else it derives) along with it – see this module’s own doc – so nothing further needs clearing from here.

§Errors

The same as Self::set_anchor.

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> Same for T

Source§

type Output = T

Should always be Self
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.