Skip to content

Commit 3330c05

Browse files
committed
Cleanup code
1 parent 0532122 commit 3330c05

File tree

4 files changed

+0
-41
lines changed

4 files changed

+0
-41
lines changed

compiler/src/gen/base/structure.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ use std::borrow::Cow;
3838
pub trait Utilities {
3939
fn get_field_type(field_type: FixedFieldType) -> &'static str;
4040
fn get_fragment_name(field: &Field) -> &'static str;
41-
fn get_fragment_name_mut(field: &Field) -> &'static str;
4241
fn get_bit_codec_inline(endianness: Endianness) -> &'static str;
4342
fn get_byte_codec_inline(endianness: Endianness) -> &'static str;
4443
fn get_byte_codec(endianness: Endianness) -> &'static str;

compiler/src/gen/codec.rs

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,6 @@
2929
use crate::gen::template::Template;
3030
use std::collections::HashMap;
3131

32-
//TODO: Allow using a single file per codec instead of 3 files.
33-
34-
pub struct Codec<'fragment, 'variable> {
35-
pub decl: Template<'fragment, 'variable>,
36-
pub from_bytes: Template<'fragment, 'variable>,
37-
pub write: Template<'fragment, 'variable>,
38-
}
39-
40-
impl Codec<'_, '_> {
41-
pub fn from_static_bytes(decl: &'static [u8], from_bytes: &'static [u8], write: &'static [u8]) -> Self {
42-
Self {
43-
decl: Template::compile(decl).unwrap(),
44-
from_bytes: Template::compile(from_bytes).unwrap(),
45-
write: Template::compile(write).unwrap(),
46-
}
47-
}
48-
}
49-
5032
macro_rules! count {
5133
() => (0usize);
5234
( $x:tt $($xs:tt)* ) => (1usize + count!($($xs)*));

compiler/src/gen/rust/util.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -169,17 +169,6 @@ impl crate::gen::base::structure::Utilities for RustUtils {
169169
}
170170

171171
fn get_fragment_name(field: &crate::compiler::structure::Field) -> &'static str {
172-
//TODO: Check if unwrap is safe
173-
let raw_field_type = field.ty.as_fixed().unwrap().bits_type;
174-
let raw_field_byte_size = raw_field_type.get_byte_size();
175-
match raw_field_byte_size != field.loc.byte_size {
176-
true => "unaligned",
177-
false => "aligned",
178-
}
179-
}
180-
181-
fn get_fragment_name_mut(field: &crate::compiler::structure::Field) -> &'static str {
182-
//TODO: Check if unwrap is safe
183172
let raw_field_type = field.ty.as_fixed().unwrap().bits_type;
184173
let raw_field_byte_size = raw_field_type.get_byte_size();
185174
match raw_field_byte_size != field.loc.byte_size {

compiler/src/gen/swift/util.rs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,6 @@ impl crate::gen::base::structure::Utilities for SwiftUtils {
8181
}
8282

8383
fn get_fragment_name(field: &Field) -> &'static str {
84-
//TODO: Check if unwrap is safe
85-
let raw_field_type = field.ty.as_fixed().unwrap().bits_type;
86-
let raw_field_byte_size = raw_field_type.get_byte_size();
87-
match raw_field_byte_size != field.loc.byte_size {
88-
true => "unaligned",
89-
false => "aligned",
90-
}
91-
}
92-
93-
fn get_fragment_name_mut(field: &Field) -> &'static str {
94-
//TODO: Check if unwrap is safe
9584
let raw_field_type = field.ty.as_fixed().unwrap().bits_type;
9685
let raw_field_byte_size = raw_field_type.get_byte_size();
9786
match raw_field_byte_size != field.loc.byte_size {

0 commit comments

Comments
 (0)