Skip to main content

VarLongWrite

Trait VarLongWrite 

Source
pub trait VarLongWrite: Write {
    // Provided methods
    fn write_varlong(&mut self, value: i64) -> Result<(), CodecError> { ... }
    fn write_varlong_with_size(
        &mut self,
        value: i64,
    ) -> Result<usize, CodecError> { ... }
}
Expand description

Extension methods for writing Minecraft protocol VarLong values.

This trait is implemented for every Write type.

§Example

use mcproto_codec::varlong::VarLongWrite;

let mut output = Vec::new();
output.write_varlong(9_223_372_036_854_775_000)?;

Provided Methods§

Source

fn write_varlong(&mut self, value: i64) -> Result<(), CodecError>

Writes value to this writer as a VarLong.

§Errors

Returns a CodecError if the underlying writer fails. The error’s byte count reports how much of this value was written successfully.

Source

fn write_varlong_with_size(&mut self, value: i64) -> Result<usize, CodecError>

Writes value as a VarLong and returns the number of bytes written.

§Errors

Returns a CodecError if the underlying writer fails. The error’s byte count reports how much of this value was written successfully.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§