Context

Struct Context 

#[repr(C)]
pub struct Context { context_id: Id, log_level_pos: i32, log_level_ptr: *mut i8, trace_status_ptr: *mut i8, mcnt: u8, }
Expand description

This structure is used for every context used in an application.

Fields§

§context_id: Id

context id

§log_level_pos: i32

offset in user-application context field

§log_level_ptr: *mut i8

pointer to the log level

§trace_status_ptr: *mut i8

pointer to the trace status

§mcnt: u8

message counter

Implementations§

§

impl Context

pub const fn empty() -> Self

pub const fn context_id(&self) -> &Id

pub fn log_level(&self) -> LogLevel

pub fn is_log_level_enabled(&self, level: LogLevel) -> bool

Checks the log level passed by the log function if enabled for that context or not.

This function can be called by applications before generating their logs. Also called before writing new log messages.

pub unsafe fn log( &self, level: LogLevel, buffer: *mut c_char, size: usize, args_num: i32, ) -> ReturnValue

Writes a log message to the DLT daemon.

§Safety

This function is unsafe because it dereferences the buffer pointer. buffer must be a valid pointer to a buffer of size bytes.

Trait Implementations§

§

impl Send for Context

§

impl Sync for Context

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.