77from tomlkit import dump , load , table
88
99from somesy .core .models import Person , ProjectMetadata
10- from somesy .core .writer import IgnoreKey , ProjectMetadataWriter
10+ from somesy .core .writer import FieldKeyMapping , IgnoreKey , ProjectMetadataWriter
1111
1212from .models import RustConfig , check_keyword
1313
1717class Rust (ProjectMetadataWriter ):
1818 """Rust config file handler parsed from Cargo.toml."""
1919
20- def __init__ (self , path : Path , * , direct_mappings = None ):
20+ def __init__ (self , path : Path ):
2121 """Rust config file handler parsed from Cargo.toml.
2222
2323 See [somesy.core.writer.ProjectMetadataWriter.__init__][].
2424 """
2525 self ._section = ["package" ]
26- super ().__init__ (
27- path , create_if_not_exists = False , direct_mappings = direct_mappings or {}
28- )
26+ mappings : FieldKeyMapping = {
27+ "maintainers" : IgnoreKey (),
28+ }
29+ super ().__init__ (path , create_if_not_exists = False , direct_mappings = mappings )
2930
3031 def _load (self ) -> None :
3132 """Load Cargo.toml file."""
@@ -51,9 +52,11 @@ def save(self, path: Optional[Path] = None) -> None:
5152 dump (self ._data , f )
5253
5354 def _get_property (
54- self , key : Union [str , List [str ]], * , remove : bool = False , ** kwargs
55+ self , key : Union [str , List [str ], IgnoreKey ], * , remove : bool = False , ** kwargs
5556 ) -> Optional [Any ]:
5657 """Get a property from the Cargo.toml file."""
58+ if isinstance (key , IgnoreKey ):
59+ return None
5760 key_path = [key ] if isinstance (key , str ) else key
5861 full_path = self ._section + key_path
5962 return super ()._get_property (full_path , remove = remove , ** kwargs )
0 commit comments