Skip to main content

Context

Struct Context 

Source
pub struct Context { /* private fields */ }
Expand description

RAII wrapper around a lepcc_ContextHdl.

Each method operates on a fresh decode pass — the underlying C context is reset by each call. Context is not Send + Sync because the raw pointer is single-threaded; create one per thread / per decode call.

Implementations§

Source§

impl Context

Source

pub fn new() -> Self

Create a new LEPCC context.

§Panics

Panics if the underlying C allocation fails (returns null).

Source

pub fn blob_info(&self, data: &[u8]) -> Result<(u32, u32)>

Identify the type and byte-length of the next blob in data.

Returns (blob_type, blob_size_in_bytes).

Source

pub fn decode_xyz(&self, data: &[u8]) -> Result<Vec<[f64; 3]>>

Decode a lepcc-xyz blob into a vector of [x, y, z] coordinates.

Source

pub fn decode_rgb(&self, data: &[u8]) -> Result<Vec<[u8; 3]>>

Decode a lepcc-rgb blob into a vector of [r, g, b] byte triples.

Source

pub fn decode_intensity(&self, data: &[u8]) -> Result<Vec<u16>>

Decode a lepcc-intensity blob into a vector of u16 intensity values.

Source

pub fn decode_flag_bytes(&self, data: &[u8]) -> Result<Vec<u8>>

Decode a lepcc-flagbytes blob into a vector of classification bytes.

Source

pub fn encode_xyz(&self, points: &[[f64; 3]], max_err: f64) -> Result<Vec<u8>>

Encode XYZ coordinates into a LEPCC blob.

max_err is the maximum absolute error per axis (e.g. 0.001 metres).

Source

pub fn encode_rgb(&self, colours: &[[u8; 3]]) -> Result<Vec<u8>>

Encode RGB colours into a LEPCC blob.

Source

pub fn encode_intensity(&self, values: &[u16]) -> Result<Vec<u8>>

Encode intensity values into a LEPCC blob.

Source

pub fn encode_flag_bytes(&self, flags: &[u8]) -> Result<Vec<u8>>

Encode classification flag bytes into a LEPCC blob.

Trait Implementations§

Source§

impl Default for Context

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Drop for Context

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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.