pub fn new(io: T) -> Result<Self, Error<T::Error>> {
        let mut new = Self {
            io,
            peer: 0,
            sequence: 0,
            buffer: [0u8; 64 * 1024],
        };

        // ubus server should say hello on connect
        let message = new.next_message()?;

        // Verify the header is what we expect
        valid_data!(
            message.header.message == MessageType::HELLO,
            "Expected hello"
        );

        // Record our peer id
        new.peer = message.header.peer.into();

        Ok(new)
    }
/// Create a new ubus connection from an existing IO
Create a new ubus connection from an existing IO
Create a new ubus connection from an existing IO
pub fn new(io: T) -> Result<Self, Error<T::Error>> {
        let mut new = Self {
            io,
            peer: 0,
            sequence: 0,
            buffer: [0u8; 64 * 1024],
        };
        // ubus server should say hello on connect
        let message = new.next_message()?;
        // Verify the header is what we expect
        valid_data!(
            message.header.message == MessageType::HELLO,
            "Expected hello"
        );
        // Record our peer id
        new.peer = message.header.peer.into();
        Ok(new)
    }
pub fn new ( io : T ) -> Result < Self , Error < T :: Error > > { let mut new = Self { io , peer : 0 , sequence : 0 , buffer : [ 0u8 ; 64 * 1024 ] , } ; // ubus server should say hello on connect let message = new . next_message ( ) ? ; // Verify the header is what we expect valid_data ! ( message header message MessageType HELLO " " ) ; // Record our peer id new . peer = message . header . peer . into ( ) ; Ok ( new ) }
Create a new ubus connection from an existing IO
Create a new ubus connection from an existing IO
io
T
io
T