MCPcopy Create free account
hub / github.com/Rust-GPU/rust-gpu / parse_attr_int_value

Function parse_attr_int_value

crates/rustc_codegen_spirv/src/symbols.rs:539–551  ·  view source on GitHub ↗
(arg: &NestedMetaItem)

Source from the content-addressed store, hash-verified

537}
538
539fn parse_attr_int_value(arg: &NestedMetaItem) -> Result<u32, ParseAttrError> {
540 let arg = match arg.meta_item() {
541 Some(arg) => arg,
542 None => return Err((arg.span(), "attribute must have value".to_string())),
543 };
544 match arg.name_value_literal() {
545 Some(&MetaItemLit {
546 kind: LitKind::Int(x, LitIntType::Unsuffixed),
547 ..
548 }) if x <= u32::MAX as u128 => Ok(x as u32),
549 _ => Err((arg.span, "attribute value must be integer".to_string())),
550 }
551}
552
553fn parse_local_size_attr(arg: &NestedMetaItem) -> Result<[u32; 3], ParseAttrError> {
554 let arg = match arg.meta_item() {

Callers 3

parse_attrs_for_checkingFunction · 0.85
parse_spec_constant_attrFunction · 0.85
parse_entry_attrsFunction · 0.85

Calls 1

spanMethod · 0.80

Tested by

no test coverage detected