Skip to content

Commit

Permalink
Rename IntoOpaque to ToOpaque
Browse files Browse the repository at this point in the history
  • Loading branch information
XAMPPRocky committed Dec 22, 2021
1 parent a5d6316 commit 56999a8
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions standards/mib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ pub mod interfaces {
type Error = rasn::ber::enc::Error;

fn try_from(value: Entry) -> Result<Self, Self::Error> {
value.into_opaque()
value.to_opaque()
}
}

Expand Down Expand Up @@ -295,7 +295,7 @@ pub mod interfaces {
encoder: &mut EN,
tag: Tag,
) -> Result<(), EN::Error> {
self.into_opaque()
self.to_opaque()
.map_err(rasn::enc::Error::custom)?
.encode_with_tag(encoder, tag)
}
Expand Down
6 changes: 3 additions & 3 deletions standards/smi/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ macro_rules! opaque_impls {
type Error = $crate::rasn::ber::enc::Error;

fn try_from(value: $name) -> Result<Self, Self::Error> {
use $crate::v1::IntoOpaque;
value.into_opaque()
use $crate::v1::ToOpaque;
value.to_opaque()
}
}

Expand All @@ -87,7 +87,7 @@ macro_rules! opaque_impls {
encoder: &mut EN,
tag: Tag,
) -> Result<(), EN::Error> {
self.into_opaque()
self.to_opaque()
.map_err($crate::rasn::enc::Error::custom)?
.encode_with_tag(encoder, tag)
}
Expand Down
8 changes: 4 additions & 4 deletions standards/smi/src/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ pub struct Opaque(alloc::vec::Vec<u8>);

/// Helper trait for wrapping any valid ASN.1 type in an `Opaque` struct which
/// first encodes the data into Basic Encoding Rules.
pub trait IntoOpaque {
fn into_opaque(&self) -> Result<Opaque, rasn::ber::enc::Error>;
pub trait ToOpaque {
fn to_opaque(&self) -> Result<Opaque, rasn::ber::enc::Error>;
}

impl<T: Encode> IntoOpaque for T {
fn into_opaque(&self) -> Result<Opaque, rasn::ber::enc::Error> {
impl<T: Encode> ToOpaque for T {
fn to_opaque(&self) -> Result<Opaque, rasn::ber::enc::Error> {
rasn::ber::encode(self).map(Opaque)
}
}
Expand Down
2 changes: 1 addition & 1 deletion standards/smi/src/v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use rasn::{
use crate::v1::InvalidVariant;

#[doc(inline)]
pub use crate::v1::IntoOpaque;
pub use crate::v1::ToOpaque;

pub type ObjectName = crate::v1::ObjectName;
pub type NotificationName = ObjectIdentifier;
Expand Down

0 comments on commit 56999a8

Please sign in to comment.