1pub trait ObjectType
3where
4 Self: TryInto<Self::Syntax>,
5 <Self as TryInto<Self::Syntax>>::Error: rasn::enc::Error + core::fmt::Display,
6{
7 type SmiSyntax: SmiSyntax;
9 type Syntax: Into<Self::SmiSyntax>;
12 const ACCESS: Access;
14 const STATUS: Status;
16 const VALUE: &'static rasn::types::Oid;
18
19 fn into_object_syntax(
23 self,
24 codec: rasn::Codec,
25 ) -> Result<Self::SmiSyntax, <Self as TryInto<Self::Syntax>>::Error> {
26 Ok(self
27 .try_into()
28 .map_err(|e| rasn::enc::Error::custom(e, codec))?
29 .into())
30 }
31}
32
33pub trait SmiSyntax {}
35
36impl SmiSyntax for crate::v1::ObjectSyntax {}
37impl SmiSyntax for crate::v2::ObjectSyntax {}
38
39#[derive(Debug, Clone, Copy, Eq, Ord, PartialEq, PartialOrd)]
41#[non_exhaustive]
42pub enum Access {
43 ReadOnly,
44 WriteOnly,
45 ReadWrite,
46 NotAccessible,
47}
48
49#[derive(Debug, Clone, Copy, Eq, Ord, PartialEq, PartialOrd)]
51#[non_exhaustive]
52pub enum Status {
53 Current,
54 Deprecated,
55 Obsolete,
56}