-
Notifications
You must be signed in to change notification settings - Fork 506
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Major
windows-bindgen
update (#3359)
- Loading branch information
Showing
1,157 changed files
with
1,054,350 additions
and
1,157,987 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
use super::*; | ||
|
||
pub struct Derive(HashMap<TypeName, Vec<String>>); | ||
|
||
impl Derive { | ||
pub fn new(reader: &Reader, types: &TypeMap, derive: &[&str]) -> Self { | ||
let mut map = HashMap::new(); | ||
|
||
for derive in derive { | ||
let Some((name, derive)) = derive.split_once('=') else { | ||
panic!("`--derive` must be `<type name>=Comma,Separated,List"); | ||
}; | ||
|
||
let tn = get_type_name(reader, name); | ||
|
||
if !types.contains_key(&tn) { | ||
panic!("type not included: `{name}`"); | ||
} | ||
|
||
let derive = derive | ||
.split(',') | ||
.filter(|&derive| (!derive.is_empty())) | ||
.map(|derive| derive.to_string()) | ||
.collect(); | ||
map.insert(tn, derive); | ||
} | ||
|
||
Self(map) | ||
} | ||
|
||
pub fn get(&self, type_name: TypeName) -> impl Iterator<Item = String> + '_ { | ||
self.0.get(&type_name).into_iter().flatten().cloned() | ||
} | ||
} | ||
|
||
fn get_type_name(reader: &Reader, path: &str) -> TypeName { | ||
if let Some((namespace, name)) = path.rsplit_once('.') { | ||
if let Some((namespace, types)) = reader.get_key_value(namespace) { | ||
if let Some((name, _)) = types.get_key_value(name) { | ||
return TypeName(namespace, name); | ||
} | ||
} | ||
} else { | ||
for (namespace, types) in reader.iter() { | ||
if let Some((name, _)) = types.get_key_value(path) { | ||
return TypeName(namespace, name); | ||
} | ||
} | ||
} | ||
|
||
panic!("type not found: `{path}`"); | ||
} |
Oops, something went wrong.