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;
1616/// An EBML file
1717#[ derive( LoftyFile , Default ) ]
1818#[ 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) ]
2020pub struct EbmlFile {
2121 /// An EBML tag
2222 #[ lofty( tag_type = "Ebml" ) ]
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ mod attached_file;
22mod simple_tag;
33mod tag;
44mod target;
5+ mod write;
56
67pub use attached_file:: * ;
78pub use simple_tag:: * ;
@@ -39,15 +40,19 @@ impl TagExt for EbmlTag {
3940 }
4041
4142 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 ( )
4348 }
4449
4550 fn contains < ' a > ( & ' a self , _key : Self :: RefKey < ' a > ) -> bool {
4651 todo ! ( )
4752 }
4853
4954 fn is_empty ( & self ) -> bool {
50- todo ! ( )
55+ self . tags . is_empty ( ) && self . attached_files . is_empty ( )
5156 }
5257
5358 fn save_to < F > (
@@ -85,7 +90,8 @@ impl TagExt for EbmlTag {
8590 }
8691
8792 fn clear ( & mut self ) {
88- todo ! ( )
93+ self . tags . clear ( ) ;
94+ self . attached_files . clear ( ) ;
8995 }
9096}
9197
Original file line number Diff line number Diff line change @@ -93,3 +93,12 @@ pub struct Target {
9393 /// [`AttachedFile::uid`]: crate::ebml::AttachedFile::uid
9494 pub attachment_uids : Option < Vec < u64 > > ,
9595}
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(
5151 . write_to( file, write_options)
5252 } ) ;
5353
54+ insert ! ( map, Ebml , { todo!( ) } ) ;
55+
5456 insert ! ( map, Id3v1 , {
5557 Into :: <lofty:: id3:: v1:: tag:: Id3v1TagRef <' _>>:: into( tag) . write_to( file, write_options)
5658 } ) ;
You can’t perform that action at this time.
0 commit comments