Protocol

Struct Protocol 

Source
pub struct Protocol;
Expand description

Low-level protocol handling

Implementations§

Source§

impl Protocol

Source

pub fn parse_error_info( body: &[u8], data_end_cursor: usize, ) -> Result<(), NanonisError>

Parse error information from the end of a response body using safe slice operations

Source

pub fn read_exact_bytes<const N: usize>( reader: &mut dyn Read, ) -> Result<[u8; N], NanonisError>

Helper for reading exact byte counts with better error messages

Source

pub fn read_variable_bytes( reader: &mut dyn Read, size: usize, ) -> Result<Vec<u8>, NanonisError>

Helper for reading variable-length data with size validation

Source

pub fn parse_response_with_error_check( response: &[u8], response_types: &[&str], ) -> Result<Vec<NanonisValue>, NanonisError>

Parse response with error checking - returns (values, cursor_position)

Source

pub fn serialize_value( value: &NanonisValue, body_type: &str, buffer: &mut Vec<u8>, ) -> Result<(), NanonisError>

Serialize a value according to its type specification

Source

pub fn parse_response( response: &[u8], response_types: &[&str], ) -> Result<Vec<NanonisValue>, NanonisError>

Parse response data according to type specifications

Source

pub fn create_command_header(command: &str, body_size: u32) -> Vec<u8>

Create command header with proper padding using safe serialization

Source

pub fn validate_response_header( header: &[u8; 40], expected_command: &str, ) -> Result<u32, NanonisError>

Validate command response header

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.