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
impl Client
Sourcepub fn new(http_base: String, trust: Trust, token: Option<String>) -> Self
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.
Sourcepub fn set_anchor(
&self,
position: Position,
max_radius_m: f64,
) -> Result<(), ClientError>
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.
Sourcepub fn clear_anchor(&self) -> Result<(), ClientError>
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.