Skip to main content

MessageWriter

Trait MessageWriter 

Source
pub trait MessageWriter {
    // Required method
    async fn write_msg(&mut self, msg: &[u8]) -> Result<()>;

    // Provided method
    async fn write_msg_mut(&mut self, msg: &mut [u8]) -> Result<()> { ... }
}

Required Methods§

Source

async fn write_msg(&mut self, msg: &[u8]) -> Result<()>

Provided Methods§

Source

async fn write_msg_mut(&mut self, msg: &mut [u8]) -> Result<()>

TODO: Implement this method to fix the encryption zero-copy data corruption bug

This method should be used for encryption scenarios where:

  • Zero-copy performance is needed
  • The caller can provide mutable data
  • No unsafe transmutation is required

Default implementation falls back to the immutable version for compatibility. Encryption implementations should override this for true zero-copy operation.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§