| 1 |
//! [Object Identifiers] are a standard of the [ITU] used to reference objects, things, and |
| 2 |
//! concepts in a globally unique way. This crate provides for data structures and methods |
| 3 |
//! to build, parse, and format OIDs. |
| 4 |
//! |
| 5 |
//! |
| 6 |
//! ## Parsing OID String Representation |
| 7 |
//! ```rust |
| 8 |
//! use oid::prelude::*; |
| 9 |
//! |
| 10 |
//! fn main() -> Result<(), ObjectIdentifierError> { |
| 11 |
//! let oid = ObjectIdentifier::try_from("0.1.2.3")?; |
| 12 |
//! Ok(()) |
| 13 |
//! } |
| 14 |
//! ``` |
| 15 |
//! |
| 16 |
//! ## Parsing OID Binary Representation |
| 17 |
//! ```rust |
| 18 |
//! use oid::prelude::*; |
| 19 |
//! |
| 20 |
//! fn main() -> Result<(), ObjectIdentifierError> { |
| 21 |
//! let oid = ObjectIdentifier::try_from(vec![0x00, 0x01, 0x02, 0x03])?; |
| 22 |
//! Ok(()) |
| 23 |
//! } |
| 24 |
//! ``` |
| 25 |
//! |
| 26 |
//! ## Encoding OID as String Representation |
| 27 |
//! ```rust |
| 28 |
//! use oid::prelude::*; |
| 29 |
//! |
| 30 |
//! fn main() -> Result<(), ObjectIdentifierError> { |
| 31 |
//! let oid = ObjectIdentifier::try_from("0.1.2.3")?; |
| 32 |
//! let oid: String = oid.into(); |
| 33 |
//! assert_eq!(oid, "0.1.2.3"); |
| 34 |
//! Ok(()) |
| 35 |
//! } |
| 36 |
//! ``` |
| 37 |
//! |
| 38 |
//! ## Encoding OID as Binary Representation |
| 39 |
//! ```rust |
| 40 |
//! use oid::prelude::*; |
| 41 |
//! |
| 42 |
//! fn main() -> Result<(), ObjectIdentifierError> { |
| 43 |
//! let oid = ObjectIdentifier::try_from(vec![0x00, 0x01, 0x02, 0x03])?; |
| 44 |
//! let oid: Vec<u8> = oid.into(); |
| 45 |
//! assert_eq!(oid, vec![0x00, 0x01, 0x02, 0x03]); |
| 46 |
//! Ok(()) |
| 47 |
//! } |
| 48 |
//! ``` |
| 49 |
//! |
| 50 |
//! [Object Identifiers]: https://en.wikipedia.org/wiki/Object_identifier |
| 51 |
//! [ITU]: https://en.wikipedia.org/wiki/International_Telecommunications_Union |
| 52 |
#![doc( |
| 53 |
html_logo_url = "https://labs.unnecessary.engineering/logo.png", |
| 54 |
html_favicon_url = "https://labs.unnecessary.engineering/favicon.ico", |
| 55 |
issue_tracker_base_url = "https://github.com/UnnecessaryEngineering/oid/issues/" |
| 56 |
)] |
| 57 |
#![deny(missing_docs, unused_imports, missing_debug_implementations)] |
| 58 |
#![cfg_attr(not(feature = "std"), no_std)] |
| 59 |
|
| 60 |
#[cfg(not(feature = "std"))] |
| 61 |
#[macro_use] |
| 62 |
extern crate alloc; |
| 63 |
|
| 64 |
#[cfg(not(feature = "std"))] |
| 65 |
use alloc::{string::String, vec::Vec}; |
| 66 |
|
| 67 |
use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::convertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/::{TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#, TryIntorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#}; |
| 68 |
|
| 69 |
// OID spec doesn't specify the maximum integer size of each node, so we default to usize |
| 70 |
#[cfg(not(feature = "u32"))] |
| 71 |
type Node = usize; |
| 72 |
|
| 73 |
// Can also specifically set node size as u32, helpful for 8-bit embedded platforms |
| 74 |
#[cfg(feature = "u32")] |
| 75 |
type Noderust-analyzer cargo oid 0.2.1 Node# = u32; |
| 76 |
|
| 77 |
/// Convenience module for quickly importing the public interface (e.g., `use oid::prelude::*`) |
| 78 |
pub mod preluderust-analyzer cargo oid 0.2.1 prelude/ { |
| 79 |
pub use craterust-analyzer cargo oid 0.2.1 crate/::ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier#; |
| 80 |
pub use craterust-analyzer cargo oid 0.2.1 crate/::ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#; |
| 81 |
pub use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::convertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/::{TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#, TryIntorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryInto#}; |
| 82 |
} |
| 83 |
|
| 84 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 85 |
enum ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot# { |
| 86 |
ItuTrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#ItuT# = 0, |
| 87 |
Isorust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#Iso# = 1, |
| 88 |
JointIsoItuTrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#JointIsoItuT# = 2, |
| 89 |
} |
| 90 |
|
| 91 |
impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> for ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot# { |
| 92 |
fn intorust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifierRoot][`Into<String>`]into().(self) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# { |
| 93 |
formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}", self as u8) |
| 94 |
} |
| 95 |
} |
| 96 |
|
| 97 |
impl TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<u8> for ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot# { |
| 98 |
type Errorrust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifierRoot][`TryFrom<u8>`]Error# = ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#; |
| 99 |
fn try_fromrust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifierRoot][`TryFrom<u8>`]try_from().(value: u8) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#, Selfrust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifierRoot][`TryFrom<u8>`]::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#Error#> { |
| 100 |
match value { |
| 101 |
0 => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::ItuTrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#ItuT#), |
| 102 |
1 => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::Isorust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#Iso#), |
| 103 |
2 => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::JointIsoItuTrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#JointIsoItuT#), |
| 104 |
_ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalRootNoderust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalRootNode#), |
| 105 |
} |
| 106 |
} |
| 107 |
} |
| 108 |
|
| 109 |
/// Object Identifier Errors |
| 110 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 111 |
pub enum ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError# { |
| 112 |
/// Failed to parse OID due to illegal root node (must be 0-2 decimal) |
| 113 |
IllegalRootNoderust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalRootNode#, |
| 114 |
/// Failed to parse OID due to illegal first node (must be 0-39 decimal) |
| 115 |
IllegalFirstChildNoderust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalFirstChildNode#, |
| 116 |
/// Failed to parse OID due to illegal child node value (except first node) |
| 117 |
IllegalChildNodeValuerust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalChildNodeValue#, |
| 118 |
} |
| 119 |
|
| 120 |
/// Object Identifier (OID) |
| 121 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:)] |
| 122 |
pub struct ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 123 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root.: ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#, |
| 124 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.: u8, |
| 125 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Noderust-analyzer cargo oid 0.2.1 Node#>, |
| 126 |
} |
| 127 |
|
| 128 |
fn parse_string_first_noderust-analyzer cargo oid 0.2.1 parse_string_first_node().( |
| 129 |
nodes: &mut dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = &str>, |
| 130 |
) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<u8, ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#> { |
| 131 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(first_child_node) = nodes.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#next().() { |
| 132 |
let first_child_node: u8 = first_child_node |
| 133 |
.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().() |
| 134 |
.map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalFirstChildNoderust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalFirstChildNode#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 135 |
if first_child_node rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]gt().39 { |
| 136 |
return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalFirstChildNoderust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalFirstChildNode#); |
| 137 |
} |
| 138 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(first_child_node) |
| 139 |
} else { |
| 140 |
Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalFirstChildNoderust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalFirstChildNode#) |
| 141 |
} |
| 142 |
} |
| 143 |
|
| 144 |
fn parse_string_child_nodesrust-analyzer cargo oid 0.2.1 parse_string_child_nodes().( |
| 145 |
nodes: &mut dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = &str>, |
| 146 |
) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Noderust-analyzer cargo oid 0.2.1 Node#>, ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#> { |
| 147 |
let mut result: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Noderust-analyzer cargo oid 0.2.1 Node#> = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]; |
| 148 |
while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(node) = nodes.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#next().() { |
| 149 |
result.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().( |
| 150 |
node.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().() |
| 151 |
.map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|_| ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalChildNodeValuerust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalChildNodeValue#)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., |
| 152 |
); |
| 153 |
} |
| 154 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(result) |
| 155 |
} |
| 156 |
|
| 157 |
impl ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 158 |
fn from_stringrust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifier]from_string().<S>(value: S) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier#, ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#> |
| 159 |
where |
| 160 |
S: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>, |
| 161 |
{ |
| 162 |
let value = value.intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#into().(); |
| 163 |
let mut nodes = value.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split().("."); |
| 164 |
match &nodes.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Split<'a, P>`][Iterator]next().() { |
| 165 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(root_node_value) => { |
| 166 |
let root_node_value: Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<u8, _> = root_node_value.parserust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]parse().(); |
| 167 |
match root_node_value { |
| 168 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(root_node) => { |
| 169 |
let root_node: Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#, _> = root_node.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().(); |
| 170 |
match root_node { |
| 171 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(root) => { |
| 172 |
let first_node = parse_string_first_noderust-analyzer cargo oid 0.2.1 parse_string_first_node().(&mut nodes)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 173 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 174 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root., |
| 175 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node., |
| 176 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: parse_string_child_nodesrust-analyzer cargo oid 0.2.1 parse_string_child_nodes().(&mut nodes)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., |
| 177 |
}) |
| 178 |
} |
| 179 |
Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_err) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalRootNoderust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalRootNode#), |
| 180 |
} |
| 181 |
} |
| 182 |
Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalRootNoderust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalRootNode#), |
| 183 |
} |
| 184 |
} |
| 185 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalRootNoderust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalRootNode#), |
| 186 |
} |
| 187 |
} |
| 188 |
} |
| 189 |
|
| 190 |
impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> for &ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 191 |
fn intorust-analyzer cargo oid 0.2.1 impl#[`&ObjectIdentifier`][`Into<String>`]into().(self) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# { |
| 192 |
let mut result: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# = self.rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root..intorust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifierRoot][`Into<String>`]into().(); |
| 193 |
result.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(&formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(".{}", self.first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.)); |
| 194 |
for node in &self.child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes. { |
| 195 |
result.push_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]push_str().(&formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(".{}", node)); |
| 196 |
} |
| 197 |
result |
| 198 |
} |
| 199 |
} |
| 200 |
|
| 201 |
impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> for ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 202 |
fn intorust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifier][`Into<String>`]into().(self) -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# { |
| 203 |
(&self).intorust-analyzer cargo oid 0.2.1 impl#[`&ObjectIdentifier`][`Into<String>`]into().() |
| 204 |
} |
| 205 |
} |
| 206 |
|
| 207 |
impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>> for &ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 208 |
fn intorust-analyzer cargo oid 0.2.1 impl#[`&ObjectIdentifier`][`Into<Vec<u8>>`]into().(self) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> { |
| 209 |
let mut result: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![self.rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root. as u8]; |
| 210 |
result[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`IndexMut<I>`]index_mut(). = result[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index().0]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Mul<Self>`]mul().40 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Add<Self>`]add().self.first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.; |
| 211 |
for node in self.child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().() { |
| 212 |
// TODO bench against !*node &= 0x80, compiler may already optimize better |
| 213 |
if *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().node rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]le().<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]le(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]le().127 { |
| 214 |
result.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().node as u8); |
| 215 |
} else { |
| 216 |
let mut value = *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().node; |
| 217 |
let mut mask: Noderust-analyzer cargo oid 0.2.1 Node# = 0; |
| 218 |
let mut encoded: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]; |
| 219 |
while value rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]gt().0x80 { |
| 220 |
encoded.insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]insert().(0, (value rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitAnd<Self>`]bitand().0x7f rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().mask) as u8); |
| 221 |
value rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`ShrAssign<i32>`]shr_assign().>>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`ShrAssign<i32>`]shr_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`ShrAssign<i32>`]shr_assign().7; |
| 222 |
mask = 0x80; |
| 223 |
} |
| 224 |
encoded.insertrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]insert().(0, (value rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOr<Self>`]bitor().mask) as u8); |
| 225 |
result.appendrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]append().(&mut encoded); |
| 226 |
} |
| 227 |
} |
| 228 |
result |
| 229 |
} |
| 230 |
} |
| 231 |
|
| 232 |
impl Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>> for ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 233 |
fn intorust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifier][`Into<Vec<u8>>`]into().(self) -> Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> { |
| 234 |
(&self).intorust-analyzer cargo oid 0.2.1 impl#[`&ObjectIdentifier`][`Into<Vec<u8>>`]into().() |
| 235 |
} |
| 236 |
} |
| 237 |
|
| 238 |
impl TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<&str> for ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 239 |
type Errorrust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifier][`TryFrom<&str>`]Error# = ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#; |
| 240 |
fn try_fromrust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifier][`TryFrom<&str>`]try_from().(value: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier#, Selfrust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifier][`TryFrom<&str>`]::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#Error#> { |
| 241 |
ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier#::from_stringrust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifier]from_string().(value) |
| 242 |
} |
| 243 |
} |
| 244 |
|
| 245 |
impl TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> for ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 246 |
type Errorrust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifier][`TryFrom<String>`]Error# = ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#; |
| 247 |
fn try_fromrust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifier][`TryFrom<String>`]try_from().(value: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier#, Selfrust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifier][`TryFrom<String>`]::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#Error#> { |
| 248 |
ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier#::from_stringrust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifier]from_string().(value) |
| 249 |
} |
| 250 |
} |
| 251 |
|
| 252 |
impl TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<&[u8]> for ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 253 |
type Errorrust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifier][`TryFrom<&[u8]>`]Error# = ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#; |
| 254 |
fn try_fromrust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifier][`TryFrom<&[u8]>`]try_from().(value: &[u8]) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier#, Selfrust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifier][`TryFrom<&[u8]>`]::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#Error#> { |
| 255 |
if value.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().1 { |
| 256 |
return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalRootNoderust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalRootNode#); |
| 257 |
}; |
| 258 |
let root = ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::try_fromrust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifierRoot][`TryFrom<u8>`]try_from().(value[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Div<Self>`]div().40)?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch().; |
| 259 |
let first_node = value[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Rem<Self>`]rem().40; |
| 260 |
let mut child_nodes = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![]; |
| 261 |
let mut parsing_big_int = false; |
| 262 |
let mut big_int: Noderust-analyzer cargo oid 0.2.1 Node# = 0; |
| 263 |
for i in 1..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#value.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() { |
| 264 |
if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().parsing_big_int && value[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt().128 { |
| 265 |
child_nodes.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(value[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). as Noderust-analyzer cargo oid 0.2.1 Node#); |
| 266 |
} else { |
| 267 |
if big_int rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]gt().0 { |
| 268 |
if big_int rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]ge().Noderust-analyzer cargo oid 0.2.1 Node#::max_valuerust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[u32]max_value().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`Shr<i32>`]shr().7 { |
| 269 |
return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalChildNodeValuerust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalChildNodeValue#); |
| 270 |
} |
| 271 |
big_int rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`ShlAssign<i32>`]shl_assign().<<=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`ShlAssign<i32>`]shl_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`ShlAssign<i32>`]shl_assign().7; |
| 272 |
}; |
| 273 |
big_int rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOrAssign<Self>`]bitor_assign().|=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOrAssign<Self>`]bitor_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u32][`BitOrAssign<Self>`]bitor_assign().(value[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][Not]not().0x80) as Noderust-analyzer cargo oid 0.2.1 Node#; |
| 274 |
parsing_big_int = value[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`BitAnd<Self>`]bitand().0x80 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]ne().0; |
| 275 |
} |
| 276 |
if big_int rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u32][`PartialOrd<Self>`]gt().0 && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().parsing_big_int { |
| 277 |
child_nodes.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(big_int); |
| 278 |
big_int = 0; |
| 279 |
} |
| 280 |
} |
| 281 |
Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 282 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root., |
| 283 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node., |
| 284 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes., |
| 285 |
}) |
| 286 |
} |
| 287 |
} |
| 288 |
|
| 289 |
impl TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#<Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>> for ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 290 |
type Errorrust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifier][`TryFrom<Vec<u8>>`]Error# = ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#; |
| 291 |
fn try_fromrust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifier][`TryFrom<Vec<u8>>`]try_from().(value: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8>) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier#, Selfrust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifier][`TryFrom<Vec<u8>>`]::Errorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#Error#> { |
| 292 |
value.as_slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_slice().().try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().() |
| 293 |
} |
| 294 |
} |
| 295 |
|
| 296 |
#[cfg(feature = "serde_support")] |
| 297 |
mod serde_supportrust-analyzer cargo oid 0.2.1 serde_support/ { |
| 298 |
use superrust-analyzer cargo oid 0.2.1 crate/::*; |
| 299 |
use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/; |
| 300 |
use serderust-analyzer cargo serde 1.0.116 crate/::{derust-analyzer cargo serde 1.0.116 de/, serrust-analyzer cargo serde 1.0.116 ser/}; |
| 301 |
|
| 302 |
struct OidVisitorrust-analyzer cargo oid 0.2.1 serde_support/OidVisitor#; |
| 303 |
|
| 304 |
impl<'de> derust-analyzer cargo serde 1.0.116 de/::Visitorrust-analyzer cargo serde 1.0.116 de/Visitor#<'de> for OidVisitorrust-analyzer cargo oid 0.2.1 serde_support/OidVisitor# { |
| 305 |
type Valuerust-analyzer cargo oid 0.2.1 serde_support/impl#[OidVisitor][`Visitor<'de>`]Value# = ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier#; |
| 306 |
|
| 307 |
fn expectingrust-analyzer cargo oid 0.2.1 serde_support/impl#[OidVisitor][`Visitor<'de>`]expecting().(&self, formatter: &mut fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 308 |
formatter.write_strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]write_str().("a valid buffer representing an OID") |
| 309 |
} |
| 310 |
|
| 311 |
fn visit_bytesrust-analyzer cargo oid 0.2.1 serde_support/impl#[OidVisitor][`Visitor<'de>`]visit_bytes().<E>(self, v: &[u8]) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo oid 0.2.1 serde_support/impl#[OidVisitor][`Visitor<'de>`]::Valuerust-analyzer cargo serde 1.0.116 de/Visitor#Value#, E> |
| 312 |
where |
| 313 |
E: derust-analyzer cargo serde 1.0.116 de/::Errorrust-analyzer cargo serde 1.0.116 de/Error#, |
| 314 |
{ |
| 315 |
ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier#::try_fromrust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifier][`TryFrom<&[u8]>`]try_from().(v).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|err| { |
| 316 |
E::invalid_valuerust-analyzer cargo serde 1.0.116 de/Error#invalid_value().( |
| 317 |
derust-analyzer cargo serde 1.0.116 de/::Unexpectedrust-analyzer cargo serde 1.0.116 de/Unexpected#::Otherrust-analyzer cargo serde 1.0.116 de/Unexpected#Other#(match err { |
| 318 |
ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalRootNoderust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalRootNode# => "illegal root node", |
| 319 |
ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalFirstChildNoderust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalFirstChildNode# => "illegal first child node", |
| 320 |
ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalChildNodeValuerust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalChildNodeValue# => "illegal child node value", |
| 321 |
}), |
| 322 |
&"a valid buffer representing an OID", |
| 323 |
) |
| 324 |
}) |
| 325 |
} |
| 326 |
|
| 327 |
fn visit_strrust-analyzer cargo oid 0.2.1 serde_support/impl#[OidVisitor][`Visitor<'de>`]visit_str().<E>(self, v: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Selfrust-analyzer cargo oid 0.2.1 serde_support/impl#[OidVisitor][`Visitor<'de>`]::Valuerust-analyzer cargo serde 1.0.116 de/Visitor#Value#, E> |
| 328 |
where |
| 329 |
E: derust-analyzer cargo serde 1.0.116 de/::Errorrust-analyzer cargo serde 1.0.116 de/Error#, |
| 330 |
{ |
| 331 |
ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier#::try_fromrust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifier][`TryFrom<&str>`]try_from().(v).map_errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map_err().(|err| { |
| 332 |
E::invalid_valuerust-analyzer cargo serde 1.0.116 de/Error#invalid_value().( |
| 333 |
derust-analyzer cargo serde 1.0.116 de/::Unexpectedrust-analyzer cargo serde 1.0.116 de/Unexpected#::Otherrust-analyzer cargo serde 1.0.116 de/Unexpected#Other#(match err { |
| 334 |
ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalRootNoderust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalRootNode# => "illegal root node", |
| 335 |
ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalFirstChildNoderust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalFirstChildNode# => "illegal first child node", |
| 336 |
ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalChildNodeValuerust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalChildNodeValue# => "illegal child node value", |
| 337 |
}), |
| 338 |
&"a string representing an OID", |
| 339 |
) |
| 340 |
}) |
| 341 |
} |
| 342 |
} |
| 343 |
|
| 344 |
impl<'de> derust-analyzer cargo serde 1.0.116 de/::Deserializerust-analyzer cargo serde 1.0.116 de/Deserialize#<'de> for ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 345 |
fn deserializerust-analyzer cargo oid 0.2.1 serde_support/impl#[ObjectIdentifier][`Deserialize<'de>`]deserialize().<D>(deserializer: D) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier#, D::Errorrust-analyzer cargo serde 1.0.116 de/Deserializer#Error#> |
| 346 |
where |
| 347 |
D: derust-analyzer cargo serde 1.0.116 de/::Deserializerrust-analyzer cargo serde 1.0.116 de/Deserializer#<'de>, |
| 348 |
{ |
| 349 |
if deserializer.is_human_readablerust-analyzer cargo serde 1.0.116 de/Deserializer#is_human_readable().() { |
| 350 |
deserializer.deserialize_strrust-analyzer cargo serde 1.0.116 de/Deserializer#deserialize_str().(OidVisitorrust-analyzer cargo oid 0.2.1 serde_support/OidVisitor#) |
| 351 |
} else { |
| 352 |
deserializer.deserialize_bytesrust-analyzer cargo serde 1.0.116 de/Deserializer#deserialize_bytes().(OidVisitorrust-analyzer cargo oid 0.2.1 serde_support/OidVisitor#) |
| 353 |
} |
| 354 |
} |
| 355 |
} |
| 356 |
|
| 357 |
impl serrust-analyzer cargo serde 1.0.116 ser/::Serializerust-analyzer cargo serde 1.0.116 ser/Serialize# for ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 358 |
fn serializerust-analyzer cargo oid 0.2.1 serde_support/impl#[ObjectIdentifier][Serialize]serialize().<S>( |
| 359 |
&self, |
| 360 |
serializer: S, |
| 361 |
) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<<S as serrust-analyzer cargo serde 1.0.116 ser/::Serializerrust-analyzer cargo serde 1.0.116 ser/Serializer#>::Okrust-analyzer cargo serde 1.0.116 ser/Serializer#Ok#, <S as serrust-analyzer cargo serde 1.0.116 ser/::Serializerrust-analyzer cargo serde 1.0.116 ser/Serializer#>::Errorrust-analyzer cargo serde 1.0.116 ser/Serializer#Error#> |
| 362 |
where |
| 363 |
S: serrust-analyzer cargo serde 1.0.116 ser/::Serializerrust-analyzer cargo serde 1.0.116 ser/Serializer#, |
| 364 |
{ |
| 365 |
if serializer.is_human_readablerust-analyzer cargo serde 1.0.116 ser/Serializer#is_human_readable().() { |
| 366 |
let encoded: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# = self.intorust-analyzer cargo oid 0.2.1 impl#[`&ObjectIdentifier`][`Into<String>`]into().(); |
| 367 |
serializer.serialize_strrust-analyzer cargo serde 1.0.116 ser/Serializer#serialize_str().(&encoded) |
| 368 |
} else { |
| 369 |
let encoded: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = self.intorust-analyzer cargo oid 0.2.1 impl#[`&ObjectIdentifier`][`Into<Vec<u8>>`]into().(); |
| 370 |
serializer.serialize_bytesrust-analyzer cargo serde 1.0.116 ser/Serializer#serialize_bytes().(&encoded) |
| 371 |
} |
| 372 |
} |
| 373 |
} |
| 374 |
} |
| 375 |
|
| 376 |
#[cfg(test)] |
| 377 |
mod testsrust-analyzer cargo oid 0.2.1 tests/ { |
| 378 |
use superrust-analyzer cargo oid 0.2.1 crate/::*; |
| 379 |
|
| 380 |
#[cfg(feature = "serde_support")] |
| 381 |
mod serde_supportrust-analyzer cargo oid 0.2.1 tests/serde_support/ { |
| 382 |
use superrust-analyzer cargo oid 0.2.1 tests/::*; |
| 383 |
use serde_deriverust-analyzer cargo serde_derive 1.0.116 crate/::{Deserializerust-analyzer cargo serde_derive 1.0.116 Deserialize:, Serializerust-analyzer cargo serde_derive 1.0.116 Serialize:}; |
| •384 |
//use serde_xml_rs; |
| 385 |
|
| 386 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 387 |
fn bincode_serde_serializerust-analyzer cargo oid 0.2.1 tests/serde_support/bincode_serde_serialize().() { |
| 388 |
let expected: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 389 |
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x03, 0x05, 0x08, |
| 390 |
0x0D, 0x15, |
| 391 |
]; |
| 392 |
let oid = ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 393 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root.: ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::ItuTrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#ItuT#, |
| 394 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.: 0x01, |
| 395 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![1, 2, 3, 5, 8, 13, 21], |
| 396 |
}; |
| 397 |
let actual: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = bincoderust-analyzer cargo bincode 1.3.1 crate/::serializerust-analyzer cargo bincode 1.3.1 serialize().(&oid).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 398 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 399 |
} |
| 400 |
|
| 401 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 402 |
fn bincode_serde_deserializerust-analyzer cargo oid 0.2.1 tests/serde_support/bincode_serde_deserialize().() { |
| 403 |
let expected = ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 404 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root.: ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::ItuTrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#ItuT#, |
| 405 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.: 0x01, |
| 406 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![1, 2, 3, 5, 8, 13, 21], |
| 407 |
}; |
| 408 |
let actual: ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# = bincoderust-analyzer cargo bincode 1.3.1 crate/::deserializerust-analyzer cargo bincode 1.3.1 deserialize().(&[ |
| 409 |
0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x03, 0x05, 0x08, |
| 410 |
0x0D, 0x15, |
| 411 |
]) |
| 412 |
.unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(); |
| 413 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 414 |
} |
| 415 |
|
| 416 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, Deserializerust-analyzer cargo serde_derive 1.0.116 Deserialize:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Serializerust-analyzer cargo serde_derive 1.0.116 Serialize:)] |
| 417 |
struct MyStructrust-analyzer cargo oid 0.2.1 tests/serde_support/MyStruct# { |
| 418 |
oidrust-analyzer cargo oid 0.2.1 tests/serde_support/MyStruct#oid.: ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# |
| 419 |
} |
| 420 |
|
| •421 |
/*#[test] |
| 422 |
fn xml_serde_serialize() { |
| 423 |
let mydata = MyStruct { |
| 424 |
oid: ObjectIdentifier::try_from("1.2.3.5.8.13.21").unwrap() |
| 425 |
}; |
| 426 |
let expected = r#"<MyStruct><oid>1.2.3.5.8.13.21</oid></MyStruct>"#; |
| 427 |
let actual = serde_xml_rs::to_string(&mydata).unwrap(); |
| 428 |
assert_eq!(expected, actual); |
| •429 |
}*/ |
| 430 |
|
| •431 |
/*#[test] |
| 432 |
fn xml_serde_deserialize_element() { |
| 433 |
let src = r#"<mystruct><oid>1.2.3.5.8.13.21</oid></mystruct>"#; |
| 434 |
|
| 435 |
let expected = MyStruct { |
| 436 |
oid: ObjectIdentifier::try_from("1.2.3.5.8.13.21").unwrap() |
| 437 |
}; |
| 438 |
let actual: MyStruct = serde_xml_rs::from_str(&src).unwrap(); |
| 439 |
assert_eq!(expected, actual); |
| •440 |
}*/ |
| 441 |
|
| •442 |
/*#[test] |
| 443 |
fn xml_serde_deserialize_attribute() { |
| 444 |
let src = r#"<mystruct oid="1.2.3.5.8.13.21" />"#; |
| 445 |
|
| 446 |
let expected = MyStruct { |
| 447 |
oid: ObjectIdentifier::try_from("1.2.3.5.8.13.21").unwrap() |
| 448 |
}; |
| 449 |
let actual: MyStruct = serde_xml_rs::from_str(&src).unwrap(); |
| 450 |
assert_eq!(expected, actual); |
| •451 |
}*/ |
| 452 |
} |
| 453 |
|
| 454 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 455 |
fn encode_binary_root_node_0rust-analyzer cargo oid 0.2.1 tests/encode_binary_root_node_0().() { |
| 456 |
let expected: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0]; |
| 457 |
let oid = ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 458 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root.: ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::ItuTrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#ItuT#, |
| 459 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.: 0x00, |
| 460 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 461 |
}; |
| 462 |
let actual: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = (&oid).intorust-analyzer cargo oid 0.2.1 impl#[`&ObjectIdentifier`][`Into<Vec<u8>>`]into().(); |
| 463 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 464 |
} |
| 465 |
|
| 466 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 467 |
fn encode_binary_root_node_1rust-analyzer cargo oid 0.2.1 tests/encode_binary_root_node_1().() { |
| 468 |
let expected: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![40]; |
| 469 |
let oid = ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 470 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root.: ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::Isorust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#Iso#, |
| 471 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.: 0x00, |
| 472 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 473 |
}; |
| 474 |
let actual: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = (&oid).intorust-analyzer cargo oid 0.2.1 impl#[`&ObjectIdentifier`][`Into<Vec<u8>>`]into().(); |
| 475 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 476 |
} |
| 477 |
|
| 478 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 479 |
fn encode_binary_root_node_2rust-analyzer cargo oid 0.2.1 tests/encode_binary_root_node_2().() { |
| 480 |
let expected: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![80]; |
| 481 |
let oid = ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 482 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root.: ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::JointIsoItuTrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#JointIsoItuT#, |
| 483 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.: 0x00, |
| 484 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 485 |
}; |
| 486 |
let actual: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = (&oid).intorust-analyzer cargo oid 0.2.1 impl#[`&ObjectIdentifier`][`Into<Vec<u8>>`]into().(); |
| 487 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 488 |
} |
| 489 |
|
| 490 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 491 |
fn encode_binary_example_1rust-analyzer cargo oid 0.2.1 tests/encode_binary_example_1().() { |
| 492 |
let expected: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0x01, 0x01, 0x02, 0x03, 0x05, 0x08, 0x0D, 0x15]; |
| 493 |
let oid = ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 494 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root.: ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::ItuTrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#ItuT#, |
| 495 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.: 0x01, |
| 496 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![1, 2, 3, 5, 8, 13, 21], |
| 497 |
}; |
| 498 |
let actual: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = (&oid).intorust-analyzer cargo oid 0.2.1 impl#[`&ObjectIdentifier`][`Into<Vec<u8>>`]into().(); |
| 499 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 500 |
} |
| 501 |
|
| 502 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 503 |
fn encode_binary_example_2rust-analyzer cargo oid 0.2.1 tests/encode_binary_example_2().() { |
| 504 |
let expected: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 505 |
0x77, 0x2A, 0x93, 0x45, 0x83, 0xFF, 0x7F, 0x87, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0x53, |
| 506 |
0x92, 0x30, |
| 507 |
]; |
| 508 |
let oid = ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 509 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root.: ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::JointIsoItuTrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#JointIsoItuT#, |
| 510 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.: 39, |
| 511 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![42, 2501, 65535, 2147483647, 1235, 2352], |
| 512 |
}; |
| 513 |
let actual: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = (&oid).intorust-analyzer cargo oid 0.2.1 impl#[`&ObjectIdentifier`][`Into<Vec<u8>>`]into().(); |
| 514 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 515 |
} |
| 516 |
|
| 517 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 518 |
fn encode_string_root_node_0rust-analyzer cargo oid 0.2.1 tests/encode_string_root_node_0().() { |
| 519 |
let expected = "0.0"; |
| 520 |
let oid = ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 521 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root.: ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::ItuTrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#ItuT#, |
| 522 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.: 0x00, |
| 523 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 524 |
}; |
| 525 |
let actual: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# = (&oid).intorust-analyzer cargo oid 0.2.1 impl#[`&ObjectIdentifier`][`Into<String>`]into().(); |
| 526 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 527 |
} |
| 528 |
|
| 529 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 530 |
fn encode_string_root_node_1rust-analyzer cargo oid 0.2.1 tests/encode_string_root_node_1().() { |
| 531 |
let expected = "1.0"; |
| 532 |
let oid = ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 533 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root.: ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::Isorust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#Iso#, |
| 534 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.: 0x00, |
| 535 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 536 |
}; |
| 537 |
let actual: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# = (&oid).intorust-analyzer cargo oid 0.2.1 impl#[`&ObjectIdentifier`][`Into<String>`]into().(); |
| 538 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 539 |
} |
| 540 |
|
| 541 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 542 |
fn encode_string_root_node_2rust-analyzer cargo oid 0.2.1 tests/encode_string_root_node_2().() { |
| 543 |
let expected = "2.0"; |
| 544 |
let oid = ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 545 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root.: ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::JointIsoItuTrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#JointIsoItuT#, |
| 546 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.: 0x00, |
| 547 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 548 |
}; |
| 549 |
let actual: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# = (&oid).intorust-analyzer cargo oid 0.2.1 impl#[`&ObjectIdentifier`][`Into<String>`]into().(); |
| 550 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 551 |
} |
| 552 |
|
| 553 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 554 |
fn encode_string_example_1rust-analyzer cargo oid 0.2.1 tests/encode_string_example_1().() { |
| 555 |
let expected = "0.1.1.2.3.5.8.13.21"; |
| 556 |
let oid = ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 557 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root.: ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::ItuTrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#ItuT#, |
| 558 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.: 0x01, |
| 559 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![1, 2, 3, 5, 8, 13, 21], |
| 560 |
}; |
| 561 |
let actual: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# = (&oid).intorust-analyzer cargo oid 0.2.1 impl#[`&ObjectIdentifier`][`Into<String>`]into().(); |
| 562 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 563 |
} |
| 564 |
|
| 565 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 566 |
fn encode_string_example_2rust-analyzer cargo oid 0.2.1 tests/encode_string_example_2().() { |
| 567 |
let expected = "2.39.42.2501.65535.2147483647.1235.2352"; |
| 568 |
let oid = ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 569 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root.: ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::JointIsoItuTrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#JointIsoItuT#, |
| 570 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.: 39, |
| 571 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![42, 2501, 65535, 2147483647, 1235, 2352], |
| 572 |
}; |
| 573 |
let actual: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# = (&oid).intorust-analyzer cargo oid 0.2.1 impl#[`&ObjectIdentifier`][`Into<String>`]into().(); |
| 574 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 575 |
} |
| 576 |
|
| 577 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 578 |
fn parse_binary_root_node_0rust-analyzer cargo oid 0.2.1 tests/parse_binary_root_node_0().() { |
| 579 |
let expected = Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 580 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root.: ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::ItuTrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#ItuT#, |
| 581 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.: 0x00, |
| 582 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 583 |
}); |
| 584 |
let actual = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0x00].try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().(); |
| 585 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 586 |
} |
| 587 |
|
| 588 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 589 |
fn parse_binary_root_node_1rust-analyzer cargo oid 0.2.1 tests/parse_binary_root_node_1().() { |
| 590 |
let expected = Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 591 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root.: ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::Isorust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#Iso#, |
| 592 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.: 0x00, |
| 593 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 594 |
}); |
| 595 |
let actual = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![40].try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().(); |
| 596 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 597 |
} |
| 598 |
|
| 599 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 600 |
fn parse_binary_root_node_2rust-analyzer cargo oid 0.2.1 tests/parse_binary_root_node_2().() { |
| 601 |
let expected = Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 602 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root.: ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::JointIsoItuTrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#JointIsoItuT#, |
| 603 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.: 0x00, |
| 604 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 605 |
}); |
| 606 |
let actual = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![80].try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().(); |
| 607 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 608 |
} |
| 609 |
|
| 610 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 611 |
fn parse_binary_example_1rust-analyzer cargo oid 0.2.1 tests/parse_binary_example_1().() { |
| 612 |
let expected = Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 613 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root.: ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::ItuTrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#ItuT#, |
| 614 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.: 0x01, |
| 615 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![1, 2, 3, 5, 8, 13, 21], |
| 616 |
}); |
| 617 |
let actual = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0x01, 0x01, 0x02, 0x03, 0x05, 0x08, 0x0D, 0x15].try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().(); |
| 618 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 619 |
} |
| 620 |
|
| 621 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 622 |
fn parse_binary_example_2rust-analyzer cargo oid 0.2.1 tests/parse_binary_example_2().() { |
| 623 |
let expected = Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 624 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root.: ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::JointIsoItuTrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#JointIsoItuT#, |
| 625 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.: 39, |
| 626 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![42, 2501, 65535, 2147483647, 1235, 2352], |
| 627 |
}); |
| 628 |
let actual = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 629 |
0x77, 0x2A, 0x93, 0x45, 0x83, 0xFF, 0x7F, 0x87, 0xFF, 0xFF, 0xFF, 0x7F, 0x89, 0x53, |
| 630 |
0x92, 0x30, |
| 631 |
] |
| 632 |
.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().(); |
| 633 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 634 |
} |
| 635 |
|
| 636 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 637 |
fn parse_string_root_node_0rust-analyzer cargo oid 0.2.1 tests/parse_string_root_node_0().() { |
| 638 |
let expected = Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 639 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root.: ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::ItuTrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#ItuT#, |
| 640 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.: 0x00, |
| 641 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 642 |
}); |
| 643 |
let actual = "0.0".try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().(); |
| 644 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 645 |
} |
| 646 |
|
| 647 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 648 |
fn parse_string_root_node_1rust-analyzer cargo oid 0.2.1 tests/parse_string_root_node_1().() { |
| 649 |
let expected = Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 650 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root.: ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::Isorust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#Iso#, |
| 651 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.: 0x00, |
| 652 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 653 |
}); |
| 654 |
let actual = "1.0".try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().(); |
| 655 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 656 |
} |
| 657 |
|
| 658 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 659 |
fn parse_string_root_node_2rust-analyzer cargo oid 0.2.1 tests/parse_string_root_node_2().() { |
| 660 |
let expected = Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 661 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root.: ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::JointIsoItuTrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#JointIsoItuT#, |
| 662 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.: 0x00, |
| 663 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![], |
| 664 |
}); |
| 665 |
let actual = "2.0".try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().(); |
| 666 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 667 |
} |
| 668 |
|
| 669 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 670 |
fn parse_string_example_1rust-analyzer cargo oid 0.2.1 tests/parse_string_example_1().() { |
| 671 |
let expected = Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 672 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root.: ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::ItuTrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#ItuT#, |
| 673 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.: 0x01, |
| 674 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![1, 2, 3, 5, 8, 13, 21], |
| 675 |
}); |
| 676 |
let actual = "0.1.1.2.3.5.8.13.21".try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().(); |
| 677 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 678 |
} |
| 679 |
|
| 680 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 681 |
fn parse_string_example_2rust-analyzer cargo oid 0.2.1 tests/parse_string_example_2().() { |
| 682 |
let expected = Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 683 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root.: ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::JointIsoItuTrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#JointIsoItuT#, |
| 684 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.: 39, |
| 685 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![42, 2501, 65535, 2147483647, 1235, 2352], |
| 686 |
}); |
| 687 |
let actual = "2.39.42.2501.65535.2147483647.1235.2352".try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().(); |
| 688 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 689 |
} |
| 690 |
|
| 691 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 692 |
fn illegal_oid_rootrust-analyzer cargo oid 0.2.1 tests/illegal_oid_root().() { |
| 693 |
let expected = Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalRootNoderust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalRootNode#); |
| 694 |
for i in 3..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::u8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core legacy_int_modules/u8/::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core legacy_int_modules/u8/MAX. { |
| 695 |
let actual = ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::try_fromrust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifierRoot][`TryFrom<u8>`]try_from().(i); |
| 696 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 697 |
} |
| 698 |
} |
| 699 |
|
| 700 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 701 |
fn illegal_first_node_too_largerust-analyzer cargo oid 0.2.1 tests/illegal_first_node_too_large().() { |
| 702 |
let expected = Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalFirstChildNoderust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalFirstChildNode#); |
| 703 |
for i in 40..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::u8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core legacy_int_modules/u8/::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core legacy_int_modules/u8/MAX. { |
| 704 |
let string_val = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}.2.3.4", i); |
| 705 |
let mut nodes_iter = string_val.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split().("."); |
| 706 |
let actual = parse_string_first_noderust-analyzer cargo oid 0.2.1 parse_string_first_node().(&mut nodes_iter); |
| 707 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 708 |
} |
| 709 |
} |
| 710 |
|
| 711 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 712 |
fn illegal_first_node_emptyrust-analyzer cargo oid 0.2.1 tests/illegal_first_node_empty().() { |
| 713 |
let expected = Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalFirstChildNoderust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalFirstChildNode#); |
| 714 |
let string_val = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(); |
| 715 |
let mut nodes_iter = string_val.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split().("."); |
| 716 |
let actual = parse_string_first_noderust-analyzer cargo oid 0.2.1 parse_string_first_node().(&mut nodes_iter); |
| 717 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 718 |
} |
| 719 |
|
| 720 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 721 |
fn illegal_first_node_nonerust-analyzer cargo oid 0.2.1 tests/illegal_first_node_none().() { |
| 722 |
let expected = Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalFirstChildNoderust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalFirstChildNode#); |
| 723 |
let string_val = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().(); |
| 724 |
let mut nodes_iter = string_val.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split().("."); |
| 725 |
let _ = nodes_iter.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Split<'a, P>`][Iterator]next().(); |
| 726 |
let actual = parse_string_first_noderust-analyzer cargo oid 0.2.1 parse_string_first_node().(&mut nodes_iter); |
| 727 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 728 |
} |
| 729 |
|
| 730 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 731 |
fn illegal_first_node_largerust-analyzer cargo oid 0.2.1 tests/illegal_first_node_large().() { |
| 732 |
let expected = Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalFirstChildNoderust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalFirstChildNode#); |
| 733 |
let string_val = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("40"); |
| 734 |
let mut nodes_iter = string_val.splitrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]split().("."); |
| 735 |
let actual = parse_string_first_noderust-analyzer cargo oid 0.2.1 parse_string_first_node().(&mut nodes_iter); |
| 736 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 737 |
} |
| 738 |
|
| 739 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 740 |
fn parse_string_craprust-analyzer cargo oid 0.2.1 tests/parse_string_crap().() { |
| 741 |
let expected: Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier#, ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#> = |
| 742 |
Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalRootNoderust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalRootNode#); |
| 743 |
let actual = "wtf".try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().(); |
| 744 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 745 |
} |
| 746 |
|
| 747 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 748 |
fn parse_string_emptyrust-analyzer cargo oid 0.2.1 tests/parse_string_empty().() { |
| 749 |
let expected: Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier#, ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#> = |
| 750 |
Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalRootNoderust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalRootNode#); |
| 751 |
let actual = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]new().().try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().(); |
| 752 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 753 |
} |
| 754 |
|
| 755 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 756 |
fn parse_binary_emptyrust-analyzer cargo oid 0.2.1 tests/parse_binary_empty().() { |
| 757 |
let expected: Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier#, ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#> = |
| 758 |
Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalRootNoderust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalRootNode#); |
| 759 |
let actual = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![].try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().(); |
| 760 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 761 |
} |
| 762 |
|
| 763 |
#[cfg(feature = "u32")] |
| 764 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 765 |
fn parse_binary_example_over_u32rust-analyzer cargo oid 0.2.1 tests/parse_binary_example_over_u32().() { |
| 766 |
let expected: Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier#, ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#> = |
| 767 |
Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalChildNodeValuerust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalChildNodeValue#); |
| 768 |
let actual = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0x00].try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().(); |
| 769 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 770 |
} |
| 771 |
|
| 772 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 773 |
fn parse_binary_example_over_u128rust-analyzer cargo oid 0.2.1 tests/parse_binary_example_over_u128().() { |
| 774 |
let expected: Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier#, ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#> = |
| 775 |
Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalChildNodeValuerust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalChildNodeValue#); |
| 776 |
let actual = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 777 |
0x00, 0x89, 0x97, 0xBF, 0xA3, 0xB8, 0xE8, 0xB3, 0xE6, 0xFB, 0xF2, 0xEA, 0xC3, 0xCA, |
| 778 |
0xF2, 0xBF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, |
| 779 |
] |
| 780 |
.try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().(); |
| 781 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 782 |
} |
| 783 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 784 |
fn parse_string_root_node_3plusrust-analyzer cargo oid 0.2.1 tests/parse_string_root_node_3plus().() { |
| 785 |
for i in 3..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::u8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core legacy_int_modules/u8/::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core legacy_int_modules/u8/MAX. { |
| 786 |
let expected: Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier#, ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#> = |
| 787 |
Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalRootNoderust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalRootNode#); |
| 788 |
let actual = formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{}", i).try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().(); |
| 789 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 790 |
} |
| 791 |
} |
| 792 |
|
| 793 |
#[cfg(feature = "u32")] |
| 794 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 795 |
fn parse_string_example_over_u32rust-analyzer cargo oid 0.2.1 tests/parse_string_example_over_u32().() { |
| 796 |
let expected: Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier#, ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#> = |
| 797 |
Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalChildNodeValuerust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalChildNodeValue#); |
| 798 |
let actual = "1.1.10000000000".try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().(); |
| 799 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 800 |
} |
| 801 |
|
| 802 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 803 |
fn parse_string_example_over_u128rust-analyzer cargo oid 0.2.1 tests/parse_string_example_over_u128().() { |
| 804 |
let expected: Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier#, ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#> = |
| 805 |
Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalChildNodeValuerust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalChildNodeValue#); |
| 806 |
let actual = "1.1.349239782398732987223423423423423423423423423423434982342342342342342342324523453452345234523452345234523452345234537234987234".try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().(); |
| 807 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 808 |
} |
| 809 |
|
| 810 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 811 |
fn parse_string_example_first_node_over_39rust-analyzer cargo oid 0.2.1 tests/parse_string_example_first_node_over_39().() { |
| 812 |
let expected: Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier#, ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#> = |
| 813 |
Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(ObjectIdentifierErrorrust-analyzer cargo oid 0.2.1 ObjectIdentifierError#::IllegalFirstChildNoderust-analyzer cargo oid 0.2.1 ObjectIdentifierError#IllegalFirstChildNode#); |
| 814 |
let actual = "1.40.1.2.3".try_intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`TryInto<U>`]try_into().(); |
| 815 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 816 |
} |
| 817 |
|
| 818 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 819 |
fn encode_to_stringrust-analyzer cargo oid 0.2.1 tests/encode_to_string().() { |
| 820 |
let expected = Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#::fromrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][`From<&str>`]from().("1.2.3.4"); |
| 821 |
let actual: Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# = ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 822 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root.: ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::Isorust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#Iso#, |
| 823 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.: 2, |
| 824 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![3, 4], |
| 825 |
} |
| 826 |
.intorust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifier][`Into<String>`]into().(); |
| 827 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 828 |
} |
| 829 |
|
| 830 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 831 |
fn encode_to_bytesrust-analyzer cargo oid 0.2.1 tests/encode_to_bytes().() { |
| 832 |
let expected = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![0x2A, 0x03, 0x04]; |
| 833 |
let actual: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<u8> = ObjectIdentifierrust-analyzer cargo oid 0.2.1 ObjectIdentifier# { |
| 834 |
rootrust-analyzer cargo oid 0.2.1 ObjectIdentifier#root.: ObjectIdentifierRootrust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#::Isorust-analyzer cargo oid 0.2.1 ObjectIdentifierRoot#Iso#, |
| 835 |
first_noderust-analyzer cargo oid 0.2.1 ObjectIdentifier#first_node.: 2, |
| 836 |
child_nodesrust-analyzer cargo oid 0.2.1 ObjectIdentifier#child_nodes.: vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![3, 4], |
| 837 |
} |
| 838 |
.intorust-analyzer cargo oid 0.2.1 impl#[ObjectIdentifier][`Into<Vec<u8>>`]into().(); |
| 839 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(expected, actual); |
| 840 |
} |
| 841 |
} |