Skip to main content

Server

Struct Server 

Source
pub struct Server<'a> { /* private fields */ }
Expand description

The server: where it runs, how it starts hosts, and its session.

Implementations§

Source§

impl<'a> Server<'a>

Source

pub fn new(cwd: PathBuf, launch: Box<dyn Launch<'a> + 'a>) -> Self

A server in the working folder cwd, starting hosts with launch. It answers every call itself until given Self::forwarding.

Source

pub fn forwarding(self, forwarding: Box<dyn Forwarding<'a> + 'a>) -> Self

The server, handing each call whose project is in another workspace to that workspace’s own server, which forwarding starts.

Source

pub fn has_game(&self) -> bool

Whether a game is running in the session.

Source

pub fn folder(&self) -> &Path

The session’s folder: the client’s first root, or the working folder.

Source

pub fn handle(&mut self, message: &str) -> Vec<String>

The messages to write for message, one JSON-RPC message: its response if it wants one (a notification and a response want none), and the server’s own request or notification it led to.

Source

pub fn poll(&mut self) -> Vec<String>

The notification the client gets when the tools it should list changed: once the followed server has answered initialize, its list, if it isn’t the server’s. Asks nothing of a server still building.

Source

pub fn call( &mut self, op: Op, session: bool, arguments: Value, ) -> (Value, Option<String>)

The answer of the tool of op (a session tool if session) to arguments, as JSON, and its picture, if it has one: this server’s own.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for Server<'a>

§

impl<'a> !Send for Server<'a>

§

impl<'a> !Sync for Server<'a>

§

impl<'a> !UnwindSafe for Server<'a>

§

impl<'a> Freeze for Server<'a>

§

impl<'a> Unpin for Server<'a>

§

impl<'a> UnsafeUnpin for Server<'a>

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.