Skip to main content

RedisModuleIO

Struct RedisModuleIO 

Source
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

Source

pub fn new(io: *mut RedisModuleIO) -> Self

Creates a new RedisModuleIO wrapper from a raw pointer.

Source

pub fn as_ptr(&self) -> *mut RedisModuleIO

Returns the raw RedisModuleIO pointer.

Source

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.

Source

pub fn write_string(&mut self, s: &str)

Writes a string to the IO stream.

Source

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.

Source

pub fn write_unsigned(&mut self, val: u64)

Writes an unsigned integer to the IO stream.

Source

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.

Source

pub fn write_signed(&mut self, val: i64)

Writes a signed integer to the IO stream.

Source

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.

Source

pub fn write_double(&mut self, val: f64)

Writes a double to the IO stream.

Source

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.

Source

pub fn write_float(&mut self, val: f32)

Writes a float to the IO stream.

Source

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.

Source

pub fn write_slice(&mut self, buf: &[u8])

Writes a slice to the IO stream.

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.