Skip to content

Commit bf20aa0

Browse files
committed
wip
1 parent 73192a8 commit bf20aa0

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

src/wrappers.rs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::utils::{enum_variant_name, sanitize_name, ToIdent};
1212

1313
/// Wrapper around [`Dbc`] used during code generation. Holds a pre-built vec of [`MessageGen`] for the DBC's messages.
1414
#[derive(Clone)]
15-
pub struct DbcGen<'a> {
15+
pub(crate) struct DbcGen<'a> {
1616
inner: &'a Dbc,
1717
messages: Vec<MessageGen<'a>>,
1818
}
@@ -53,15 +53,15 @@ impl<'a> DbcGen<'a> {
5353

5454
/// Wrapper around [`Message`] used during code generation. Holds a pre-built vec of [`SignalGen`] for the message's signals.
5555
#[derive(Clone)]
56-
pub struct MessageGen<'a> {
56+
pub(crate) struct MessageGen<'a> {
5757
inner: &'a Message,
5858
signals: Vec<SignalGen<'a>>,
5959
type_name: Ident,
6060
}
6161

6262
impl<'a> MessageGen<'a> {
6363
/// Creates a wrapper and builds the cached signals list and type name.
64-
pub(crate) fn new(inner: &'a Message) -> MessageGen<'a> {
64+
pub fn new(inner: &'a Message) -> MessageGen<'a> {
6565
MessageGen {
6666
inner,
6767
signals: inner.signals.iter().map(SignalGen::new).collect(),
@@ -151,12 +151,11 @@ impl Deref for MessageGen<'_> {
151151

152152
/// Wrapper around [`Signal`] used during code generation. Caches [`ValType`] and name-derived idents to avoid repeated computation.
153153
#[derive(Clone)]
154-
pub struct SignalGen<'a> {
154+
pub(crate) struct SignalGen<'a> {
155155
inner: &'a Signal,
156156
typ: ValType,
157157
typ_int: ValType,
158158
typ_uint: ValType,
159-
/// Cached field name (`snake_case`), built at construction.
160159
field_name: Ident,
161160
}
162161

@@ -170,7 +169,7 @@ impl Deref for SignalGen<'_> {
170169

171170
impl<'a> SignalGen<'a> {
172171
/// Creates a wrapper and caches the signal's value types and name-derived idents.
173-
pub(crate) fn new(inner: &'a Signal) -> SignalGen<'a> {
172+
pub fn new(inner: &'a Signal) -> SignalGen<'a> {
174173
SignalGen {
175174
inner,
176175
typ: ValType::from_signal(inner),
@@ -180,19 +179,19 @@ impl<'a> SignalGen<'a> {
180179
}
181180
}
182181

183-
pub(crate) fn typ(&self) -> ValType {
182+
pub fn typ(&self) -> ValType {
184183
self.typ
185184
}
186-
pub(crate) fn typ_ident(&self) -> Ident {
185+
pub fn typ_ident(&self) -> Ident {
187186
self.typ.ident()
188187
}
189-
pub(crate) fn typ_int(&self) -> ValType {
188+
pub fn typ_int(&self) -> ValType {
190189
self.typ_int
191190
}
192-
pub(crate) fn typ_uint(&self) -> ValType {
191+
pub fn typ_uint(&self) -> ValType {
193192
self.typ_uint
194193
}
195-
pub(crate) fn typ_uint_to_int(&self) -> Option<ValType> {
194+
pub fn typ_uint_to_int(&self) -> Option<ValType> {
196195
self.typ_uint.unsigned_to_signed()
197196
}
198197

0 commit comments

Comments
 (0)