Skip to content

Commit 9668055

Browse files
authored
remove utility functions that were never needed (#546)
we can just invoke the trait directly, its simpler
1 parent bef978a commit 9668055

File tree

2 files changed

+3
-30
lines changed

2 files changed

+3
-30
lines changed

asn1_derive/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ fn generate_read_element(
700700
}
701701
}
702702
OpType::DefinedBy(ident) => quote::quote! {
703-
asn1::read_defined_by(#ident, p)#add_error_location?
703+
asn1::Asn1DefinedByReadable::parse(#ident, p)#add_error_location?
704704
},
705705
};
706706
if let Some(default) = default {
@@ -932,7 +932,7 @@ fn generate_write_element(
932932
OpType::Regular => {
933933
if let Some(defined_by_marker_read) = defined_by_marker_origin {
934934
quote::quote! {
935-
w.write_element(asn1::writable_defined_by_item(#defined_by_marker_read))?;
935+
w.write_element(asn1::Asn1DefinedByWritable::item(#defined_by_marker_read))?;
936936
}
937937
} else {
938938
quote::quote! {
@@ -941,7 +941,7 @@ fn generate_write_element(
941941
}
942942
}
943943
OpType::DefinedBy(_) => quote::quote! {
944-
asn1::write_defined_by(#field_read, &mut w)?;
944+
asn1::Asn1DefinedByWritable::write(#field_read, &mut w)?;
945945
},
946946
};
947947

src/lib.rs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -206,33 +206,6 @@ pub const fn explicit_tag(tag: u32) -> Tag {
206206
Tag::new(tag, tag::TagClass::ContextSpecific, true)
207207
}
208208

209-
/// This API is public so that it may be used from macros, but should not be
210-
/// considered a part of the supported API surface.
211-
#[doc(hidden)]
212-
pub fn read_defined_by<'a, T: Asn1Readable<'a>, U: Asn1DefinedByReadable<'a, T>>(
213-
v: T,
214-
p: &mut Parser<'a>,
215-
) -> ParseResult<U> {
216-
U::parse(v, p)
217-
}
218-
219-
/// This API is public so that it may be used from macros, but should not be
220-
/// considered a part of the supported API surface.
221-
#[doc(hidden)]
222-
pub fn write_defined_by<T: Asn1Writable, U: Asn1DefinedByWritable<T>>(
223-
v: &U,
224-
w: &mut Writer<'_>,
225-
) -> WriteResult {
226-
v.write(w)
227-
}
228-
229-
/// This API is public so that it may be used from macros, but should not be
230-
/// considered a part of the supported API surface.
231-
#[doc(hidden)]
232-
pub fn writable_defined_by_item<T: Asn1Writable, U: Asn1DefinedByWritable<T>>(v: &U) -> &T {
233-
v.item()
234-
}
235-
236209
/// Utility for use in `asn1_derive`. Not considered part of the public API.
237210
#[doc(hidden)]
238211
pub trait OptionExt {

0 commit comments

Comments
 (0)