pub struct Connection {
pub key: PublicKey,
pub addr: SocketAddr,
pub stream: TcpStream,
pub state: TransportState,
}Fields§
§key: PublicKey§addr: SocketAddr§stream: TcpStream§state: TransportStateImplementations§
Source§impl Connection
impl Connection
pub async fn accept( conf: Arc<Config>, stream: TcpStream, ) -> Result<Self, NetworkError>
pub async fn connect(conf: Arc<Config>, peer: PublicKey, addr: NetAddr) -> Self
Sourcepub async fn send_hello(&mut self, h: Hello) -> Result<(), NetworkError>
pub async fn send_hello(&mut self, h: Hello) -> Result<(), NetworkError>
Send a Hello frame.
Sourcepub async fn recv_hello(&mut self) -> Result<Hello, NetworkError>
pub async fn recv_hello(&mut self) -> Result<Hello, NetworkError>
Read a Hello frame.
Auto Trait Implementations§
impl !Freeze for Connection
impl !RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl UnsafeUnpin for Connection
impl !UnwindSafe for Connection
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