pub struct Server { /* private fields */ }Implementations§
Source§impl Server
Graviton Server entry point
impl Server
Graviton Server entry point
§Example
let (to_core, from_core) = channel::<Messages>(1);
// A pointer to a StatesList
let states = {
// A basic State with ID '1' and no extensions
let sample_state = State::new(1, ExtensionsManager::new(to_core.clone(), None), Box::new(MemoryPersistor::new()));
// A StatesList with the previous state
let states = StatesList::new()
.with_state(sample_state);
Arc::new(Mutex::new(states))
};
// Crate a HTTP TransportHandler and a configuration
let http_handler = HTTPHandler::builder().build();
// Create the configuration
let config = Configuration::new(Box::new(http_handler), to_core, from_core);
// Create a Core
let core = Server::new(config, states);
// Run the core
core.run();Sourcepub fn new(config: Configuration, states: Arc<Mutex<StatesList>>) -> Self
pub fn new(config: Configuration, states: Arc<Mutex<StatesList>>) -> Self
Create a new Server
§Arguments
config- The Core configurationstates- The States list the Core will launch with
Sourcepub async fn process_message(
states: Arc<Mutex<StatesList>>,
msg: Messages,
handler: Arc<Mutex<Box<dyn TransportHandler + Send + Sync>>>,
)
pub async fn process_message( states: Arc<Mutex<StatesList>>, msg: Messages, handler: Arc<Mutex<Box<dyn TransportHandler + Send + Sync>>>, )
Process every message
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