pub struct Server {
pub devices: Devices,
pub info: ServerInfo,
pub listen_addr: SocketAddr,
pub discovery_port: u16,
}Available on crate feature
server only.Expand description
The Alpaca server.
Fields§
§devices: DevicesRegistered devices.
info: ServerInfoGeneral server information.
listen_addr: SocketAddrAddress for the server to listen on.
Defaults to listening on an arbitrary port on all interfaces.
discovery_port: u16Port for the discovery server to listen on.
Defaults to 32227.
Implementations§
Source§impl Server
impl Server
Sourcepub const fn new(info: ServerInfo) -> Self
pub const fn new(info: ServerInfo) -> Self
Create a server with default configuration and the provided server information.
Server information can be automatically populated from Cargo.toml using the CargoServerInfo! macro:
use ascom_alpaca::api::CargoServerInfo;
let server = Server::new(CargoServerInfo!());Source§impl Server
impl Server
Sourcepub async fn bind(self) -> Result<BoundServer>
pub async fn bind(self) -> Result<BoundServer>
Binds the Alpaca and discovery servers to local ports.
Sourcepub async fn start(self) -> Result<Infallible>
pub async fn start(self) -> Result<Infallible>
Binds the Alpaca and discovery servers to local ports and starts them.
This is a convenience method that is equivalent to calling Self::bind and BoundServer::start.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Server
impl !RefUnwindSafe for Server
impl Send for Server
impl Sync for Server
impl Unpin for Server
impl !UnwindSafe for Server
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more