pub struct RedisModuleIO { /* private fields */ }Expand description
Wrapper around RedisModuleIO for type-safe serialization/deserialization.
This wrapper provides an ergonomic API for working with RedisModuleIO RDB serialization operations while maintaining compatibility with the underlying C bindings.
Implementations§
Source§impl RedisModuleIO
impl RedisModuleIO
Sourcepub fn new(io: *mut RedisModuleIO) -> Self
pub fn new(io: *mut RedisModuleIO) -> Self
Creates a new RedisModuleIO wrapper from a raw pointer.
Sourcepub fn as_ptr(&self) -> *mut RedisModuleIO
pub fn as_ptr(&self) -> *mut RedisModuleIO
Returns the raw RedisModuleIO pointer.
Sourcepub fn read_string(&mut self) -> Result<String, Error>
pub fn read_string(&mut self) -> Result<String, Error>
Reads a string from the IO stream.
§Errors
Returns an error if the operation fails or if an IO error occurred.
Sourcepub fn write_string(&mut self, s: &str)
pub fn write_string(&mut self, s: &str)
Writes a string to the IO stream.
Sourcepub fn read_unsigned(&mut self) -> Result<u64, Error>
pub fn read_unsigned(&mut self) -> Result<u64, Error>
Reads an unsigned integer from the IO stream.
§Errors
Returns an error if the operation fails or if an IO error occurred.
Sourcepub fn write_unsigned(&mut self, val: u64)
pub fn write_unsigned(&mut self, val: u64)
Writes an unsigned integer to the IO stream.
Sourcepub fn read_signed(&mut self) -> Result<i64, Error>
pub fn read_signed(&mut self) -> Result<i64, Error>
Reads a signed integer from the IO stream.
§Errors
Returns an error if the operation fails or if an IO error occurred.
Sourcepub fn write_signed(&mut self, val: i64)
pub fn write_signed(&mut self, val: i64)
Writes a signed integer to the IO stream.
Sourcepub fn read_double(&mut self) -> Result<f64, Error>
pub fn read_double(&mut self) -> Result<f64, Error>
Reads a double from the IO stream.
§Errors
Returns an error if the operation fails or if an IO error occurred.
Sourcepub fn write_double(&mut self, val: f64)
pub fn write_double(&mut self, val: f64)
Writes a double to the IO stream.
Sourcepub fn read_float(&mut self) -> Result<f32, Error>
pub fn read_float(&mut self) -> Result<f32, Error>
Reads a float from the IO stream.
§Errors
Returns an error if the operation fails or if an IO error occurred.
Sourcepub fn write_float(&mut self, val: f32)
pub fn write_float(&mut self, val: f32)
Writes a float to the IO stream.
Sourcepub fn read_string_buffer(&mut self) -> Result<RedisBuffer, Error>
pub fn read_string_buffer(&mut self) -> Result<RedisBuffer, Error>
Reads a string buffer from the IO stream.
§Errors
Returns an error if the operation fails or if an IO error occurred.
Sourcepub fn write_slice(&mut self, buf: &[u8])
pub fn write_slice(&mut self, buf: &[u8])
Writes a slice to the IO stream.