Struct FormatRfc5424Sd

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

A RFC5424 SD-ELEMENT of the STRUCTURED-DATA.

i.e [exampleSDID@32473 iut=“3” eventSource=“Application” eventID=“1011”]

RFC:

SD-IDs are case-sensitive and uniquely identify the type and purpose of the SD-ELEMENT. The same SD-ID MUST NOT exist more than once in a message.

There are two formats for SD-ID names:

    • Names that do not contain an at-sign (“@”, ABNF %d64) are reserved to be assigned by IETF
    • Anyone can define additional SD-IDs using names in the format name@, e.g., “ourSDID@32473”. The format of the part preceding the at-sign is not specified; sd_id

RFC:

Each SD-PARAM consists of a name, referred to as PARAM-NAME, and a value, referred to as PARAM-VALUE. PARAM-NAME is case-sensitive. To support international characters, the PARAM-VALUE field MUST be encoded using UTF-8. vals

Implementations§

Source§

impl FormatRfc5424Sd

Source

pub fn new(sd_id: &'static str, vals_cnt: usize) -> SyRes<Self>

Creates the second type of the SD-ID in format of name@, e.g., “ourSDID@32473”.

RFC5424:

The format of the part preceding the at-sign is not specified;
however, these names MUST be printable US-ASCII strings, and MUST
NOT contain an at-sign ('@', ABNF %d64), an equal-sign ('=', ABNF
%d61), a closing brace (']', ABNF %d93), a quote-character ('"',
ABNF %d34), whitespace, or control characters.  The part following
the at-sign MUST be a private enterprise number as specified in
Section 7.2.2.  Please note that throughout this document the
value of 32473 is used for all private enterprise numbers.  This
value has been reserved by IANA to be used as an example number in
documentation.  Implementors will need to use their own private
enterprise number for the enterpriseId parameter, and when
creating locally extensible SD-ID names.
§Arguments
  • sd_id - a sd_id which is stored with static lifetime.

  • vals_cnt - amount of the values to be added.

§Returns

A Result in form of SyRes is returned.

Source

pub fn push( &mut self, key: Cow<'static, str>, val: Cow<'static, str>, ) -> SyRes<()>

Inserts the SD-PARAM into list. An SD-PARAM MAY be repeated multiple times inside an SD-ELEMENT.

Trait Implementations§

Source§

impl Clone for FormatRfc5424Sd

Source§

fn clone(&self) -> FormatRfc5424Sd

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FormatRfc5424Sd

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for FormatRfc5424Sd

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.