-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refuc(crypto-helper): asn1: replace some strings components with macr…
…o generation;
- Loading branch information
1 parent
c1abf5f
commit 3b09192
Showing
6 changed files
with
40 additions
and
84 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
#[macro_use] | ||
mod macros; | ||
|
||
mod asn1_viewer; | ||
mod hex_view; | ||
mod node_options; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
macro_rules! define_string_node { | ||
($name:ident) => { | ||
paste::paste! { | ||
#[derive(PartialEq, Properties, Clone)] | ||
pub struct [<$name NodeProps>] { | ||
pub node: [<Owned $name>], | ||
pub meta: OwnedRawAsn1EntityData, | ||
} | ||
|
||
#[allow(non_snake_case)] | ||
#[function_component([<$name Node >])] | ||
pub fn [<__fn_ $name>](props: &[<$name NodeProps>]) -> Html { | ||
let offset = props.meta.tag_position(); | ||
let length_len = props.meta.length_range().len(); | ||
let data_len = props.meta.data_range().len(); | ||
|
||
html! { | ||
<div class="terminal-asn1-node"> | ||
<NodeOptions node_bytes={props.meta.raw_bytes().to_vec()} {offset} {length_len} {data_len} name={stringify!($name)}/> | ||
<span class="asn-simple-value">{props.node.string().to_owned()}</span> | ||
</div> | ||
} | ||
} | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters