pub struct CtfLoopResponder<'a> { /* private fields */ }Expand description
CtfLoopResponder is a Builder pattern like to build a loop responder.
The main function connect to the server and run the same routine on every incoming message.
Implementations§
Source§impl<'a> CtfLoopResponder<'a>
impl<'a> CtfLoopResponder<'a>
Sourcepub fn responder_func(
self,
responder_func: impl Fn(&str) -> Option<String> + 'static,
) -> Self
pub fn responder_func( self, responder_func: impl Fn(&str) -> Option<String> + 'static, ) -> Self
Set the responder routine runned on each server’s message.
Sourcepub fn connect_and_work(&self) -> Result<String, CtfTcpHandlerError>
pub fn connect_and_work(&self) -> Result<String, CtfTcpHandlerError>
Connect to the server and use the struct routine to answer each incoming message.
§Errors
The function will fail if either url, port or responder routine is not defined. It may also fails if TCP connection fail.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for CtfLoopResponder<'a>
impl<'a> !RefUnwindSafe for CtfLoopResponder<'a>
impl<'a> !Send for CtfLoopResponder<'a>
impl<'a> !Sync for CtfLoopResponder<'a>
impl<'a> Unpin for CtfLoopResponder<'a>
impl<'a> !UnwindSafe for CtfLoopResponder<'a>
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