pub struct Protocol;Expand description
Low-level protocol handling
Implementations§
Source§impl Protocol
impl Protocol
Sourcepub fn parse_error_info(
body: &[u8],
data_end_cursor: usize,
) -> Result<(), NanonisError>
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
Sourcepub fn read_exact_bytes<const N: usize>(
reader: &mut dyn Read,
) -> Result<[u8; N], NanonisError>
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
Sourcepub fn read_variable_bytes(
reader: &mut dyn Read,
size: usize,
) -> Result<Vec<u8>, NanonisError>
pub fn read_variable_bytes( reader: &mut dyn Read, size: usize, ) -> Result<Vec<u8>, NanonisError>
Helper for reading variable-length data with size validation
Sourcepub fn parse_response_with_error_check(
response: &[u8],
response_types: &[&str],
) -> Result<Vec<NanonisValue>, NanonisError>
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)
Sourcepub fn serialize_value(
value: &NanonisValue,
body_type: &str,
buffer: &mut Vec<u8>,
) -> Result<(), NanonisError>
pub fn serialize_value( value: &NanonisValue, body_type: &str, buffer: &mut Vec<u8>, ) -> Result<(), NanonisError>
Serialize a value according to its type specification
Sourcepub fn parse_response(
response: &[u8],
response_types: &[&str],
) -> Result<Vec<NanonisValue>, NanonisError>
pub fn parse_response( response: &[u8], response_types: &[&str], ) -> Result<Vec<NanonisValue>, NanonisError>
Parse response data according to type specifications
Sourcepub fn create_command_header(command: &str, body_size: u32) -> Vec<u8> ⓘ
pub fn create_command_header(command: &str, body_size: u32) -> Vec<u8> ⓘ
Create command header with proper padding using safe serialization
Sourcepub fn validate_response_header(
header: &[u8; 40],
expected_command: &str,
) -> Result<u32, NanonisError>
pub fn validate_response_header( header: &[u8; 40], expected_command: &str, ) -> Result<u32, NanonisError>
Validate command response header
Auto Trait Implementations§
impl Freeze for Protocol
impl RefUnwindSafe for Protocol
impl Send for Protocol
impl Sync for Protocol
impl Unpin for Protocol
impl UnwindSafe for Protocol
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