pub struct Service {
pub name: String,
pub version: u16,
pub description: String,
/* private fields */
}
Expand description
A service representation on the qrpc system
Use this struct to handle RPC connections to the network, and to update any data you want your service to broadcast to other participants on the QRPC system.
Fields§
§name: String
§version: u16
§description: String
Implementations§
Source§impl Service
impl Service
Sourcepub fn new<S: Into<String>>(name: S, version: u16, description: S) -> Self
pub fn new<S: Into<String>>(name: S, version: u16, description: S) -> Self
Create a new service without hash_id
The hash_id
field will be filled in by the remote RPC server
after calling register()
.
Sourcepub async fn register(&mut self, socket: Arc<RpcSocket>) -> RpcResult<Identity>
pub async fn register(&mut self, socket: Arc<RpcSocket>) -> RpcResult<Identity>
Register this service with the RPC broker/ libqaul
Sourcepub fn get_socket(&self) -> Arc<RpcSocket>
pub fn get_socket(&self) -> Arc<RpcSocket>
Get the RpcSocket for this service
This function is called by other component SDKs to get access to the underlying RPC socket.
Auto Trait Implementations§
impl Freeze for Service
impl !RefUnwindSafe for Service
impl Send for Service
impl Sync for Service
impl Unpin for Service
impl !UnwindSafe for Service
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