pub struct CashGuardService { /* private fields */ }Expand description
CashGuardService handles communication with the CashGuard system.
Implementations§
Source§impl CashGuardService
impl CashGuardService
Sourcepub fn new(host: &str, port: u16, username: &str, password: &str) -> Self
pub fn new(host: &str, port: u16, username: &str, password: &str) -> Self
Creates a new instance of CashGuardService.
§Arguments
host- The hostname or IP address of the CashGuard system.port- The port number for connecting to the CashGuard system.username- The username for authentication.password- The password for authentication.
Trait Implementations§
Source§impl Clone for CashGuardService
impl Clone for CashGuardService
Source§impl Service for CashGuardService
impl Service for CashGuardService
Source§fn run<'life0, 'async_trait>(
&'life0 self,
action: Value,
write: WebSocketWrite,
) -> Pin<Box<dyn Future<Output = (i32, String)> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn run<'life0, 'async_trait>(
&'life0 self,
action: Value,
write: WebSocketWrite,
) -> Pin<Box<dyn Future<Output = (i32, String)> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Executes a service action based on the provided JSON input.
§Arguments
action- A JSON value containing the action details (e.g., command, transaction ID, amount).write- AWebSocketWriteused to send responses back through WebSocket.
§Returns
A tuple containing:
i32- Status code (0 for success, 1 for failure).String- A descriptive message regarding the action result.
Source§fn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
Converts the service instance into a dyn Any reference.
§Returns
A reference to dyn Any for dynamic type checks
Source§fn stop_service(&self)
fn stop_service(&self)
Stops the service, performing any necessary cleanup tasks.
Source§fn get_version(&self) -> String
fn get_version(&self) -> String
Retrieves the current version of the CashGuard service.
§Returns
A String containing the version of the service.
Auto Trait Implementations§
impl Freeze for CashGuardService
impl !RefUnwindSafe for CashGuardService
impl Send for CashGuardService
impl Sync for CashGuardService
impl Unpin for CashGuardService
impl !UnwindSafe for CashGuardService
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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