File tree Expand file tree Collapse file tree 5 files changed +21
-4
lines changed Expand file tree Collapse file tree 5 files changed +21
-4
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ pub use vint::VInt;
16
16
/// An EBML file
17
17
#[ derive( LoftyFile , Default ) ]
18
18
#[ lofty( read_fn = "read::read_from" ) ]
19
- // TODO: #[lofty(internal_write_module_do_not_use_anywhere_else)]
19
+ #[ lofty( internal_write_module_do_not_use_anywhere_else) ]
20
20
pub struct EbmlFile {
21
21
/// An EBML tag
22
22
#[ lofty( tag_type = "Ebml" ) ]
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ mod attached_file;
2
2
mod simple_tag;
3
3
mod tag;
4
4
mod target;
5
+ mod write;
5
6
6
7
pub use attached_file:: * ;
7
8
pub use simple_tag:: * ;
@@ -39,15 +40,19 @@ impl TagExt for EbmlTag {
39
40
}
40
41
41
42
fn len ( & self ) -> usize {
42
- todo ! ( )
43
+ self . tags
44
+ . iter ( )
45
+ . map ( |tag| tag. simple_tags . len ( ) )
46
+ . sum :: < usize > ( )
47
+ + self . attached_files . len ( )
43
48
}
44
49
45
50
fn contains < ' a > ( & ' a self , _key : Self :: RefKey < ' a > ) -> bool {
46
51
todo ! ( )
47
52
}
48
53
49
54
fn is_empty ( & self ) -> bool {
50
- todo ! ( )
55
+ self . tags . is_empty ( ) && self . attached_files . is_empty ( )
51
56
}
52
57
53
58
fn save_to < F > (
@@ -85,7 +90,8 @@ impl TagExt for EbmlTag {
85
90
}
86
91
87
92
fn clear ( & mut self ) {
88
- todo ! ( )
93
+ self . tags . clear ( ) ;
94
+ self . attached_files . clear ( ) ;
89
95
}
90
96
}
91
97
Original file line number Diff line number Diff line change @@ -93,3 +93,12 @@ pub struct Target {
93
93
/// [`AttachedFile::uid`]: crate::ebml::AttachedFile::uid
94
94
pub attachment_uids : Option < Vec < u64 > > ,
95
95
}
96
+
97
+ impl From < TargetType > for Target {
98
+ fn from ( target_type : TargetType ) -> Self {
99
+ Self {
100
+ target_type,
101
+ ..Default :: default ( )
102
+ }
103
+ }
104
+ }
Original file line number Diff line number Diff line change @@ -51,6 +51,8 @@ pub(crate) fn init_write_lookup(
51
51
. write_to( file, write_options)
52
52
} ) ;
53
53
54
+ insert ! ( map, Ebml , { todo!( ) } ) ;
55
+
54
56
insert ! ( map, Id3v1 , {
55
57
Into :: <lofty:: id3:: v1:: tag:: Id3v1TagRef <' _>>:: into( tag) . write_to( file, write_options)
56
58
} ) ;
You can’t perform that action at this time.
0 commit comments