| 1 | use proc_macro2rust-analyzer cargo proc-macro2 1.0.95 crate/::Spanrust-analyzer cargo proc-macro2 1.0.95 Span#; |
| 2 | |
| 3 | use craterust-analyzer cargo bitfields-impl 1.0.0 crate/::create_syn_errorrust-analyzer cargo bitfields-impl 1.0.0 create_syn_error().; |
| 4 | use craterust-analyzer cargo bitfields-impl 1.0.0 crate/::generationrust-analyzer cargo bitfields-impl 1.0.0 generation/::commonrust-analyzer cargo bitfields-impl 1.0.0 generation/common/::PANIC_ERROR_MESSAGErust-analyzer cargo bitfields-impl 1.0.0 generation/common/PANIC_ERROR_MESSAGE.; |
| 5 | use craterust-analyzer cargo bitfields-impl 1.0.0 crate/::parsingrust-analyzer cargo bitfields-impl 1.0.0 parsing/::typesrust-analyzer cargo bitfields-impl 1.0.0 parsing/types/::IntegerTyperust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#::{ |
| 6 | Boolrust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#Bool#, I8rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I8#, I16rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I16#, I32rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I32#, I64rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I64#, I128rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I128#, Isizerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#Isize#, U8rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U8#, U16rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U16#, U32rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U32#, U64rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U64#, U128rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U128#, UnknownIntegerrust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#UnknownInteger#, Usizerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#Usize#, |
| 7 | }; |
| 8 | |
| 9 | #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)] |
| 10 | pub(craterust-analyzer cargo bitfields-impl 1.0.0 crate/) enum IntegerTyperust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType# { |
| 11 | U8rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U8#, |
| 12 | U16rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U16#, |
| 13 | U32rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U32#, |
| 14 | U64rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U64#, |
| 15 | U128rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U128#, |
| 16 | Usizerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#Usize#, |
| 17 | Isizerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#Isize#, |
| 18 | I8rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I8#, |
| 19 | I16rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I16#, |
| 20 | I32rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I32#, |
| 21 | I64rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I64#, |
| 22 | I128rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I128#, |
| 23 | Boolrust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#Bool#, |
| 24 | UnknownIntegerrust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#UnknownInteger#, |
| 25 | } |
| 26 | |
| 27 | const UNSIGNED_INTEGER_TYPESrust-analyzer cargo bitfields-impl 1.0.0 parsing/types/UNSIGNED_INTEGER_TYPES.: [IntegerTyperust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#; 6] = [U8rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U8#, U16rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U16#, U32rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U32#, U64rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U64#, U128rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U128#, Usizerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#Usize#]; |
| 28 | const SIGNED_INTEGER_TYPESrust-analyzer cargo bitfields-impl 1.0.0 parsing/types/SIGNED_INTEGER_TYPES.: [IntegerTyperust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#; 6] = [I8rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I8#, I16rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I16#, I32rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I32#, I64rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I64#, I128rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I128#, Isizerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#Isize#]; |
| 29 | const SUPPORTED_BITFIELD_TYPESrust-analyzer cargo bitfields-impl 1.0.0 parsing/types/SUPPORTED_BITFIELD_TYPES.: [IntegerTyperust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#; 5] = [U8rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U8#, U16rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U16#, U32rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U32#, U64rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U64#, U128rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U128#]; |
| 30 | const SUPPORTED_BITFIELD_FIELD_TYPESrust-analyzer cargo bitfields-impl 1.0.0 parsing/types/SUPPORTED_BITFIELD_FIELD_TYPES.: [IntegerTyperust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#; 13] = |
| 31 | [U8rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U8#, U16rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U16#, U32rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U32#, U64rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U64#, U128rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U128#, Usizerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#Usize#, I8rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I8#, I16rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I16#, I32rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I32#, I64rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I64#, I128rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I128#, Isizerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#Isize#, Boolrust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#Bool#]; |
| 32 | const SIZE_TYPESrust-analyzer cargo bitfields-impl 1.0.0 parsing/types/SIZE_TYPES.: [IntegerTyperust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#; 2] = [Usizerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#Usize#, Isizerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#Isize#]; |
| 33 | |
| 34 | /// Returns the integer type from the type. |
| 35 | pub(craterust-analyzer cargo bitfields-impl 1.0.0 crate/) fn get_integer_type_from_typerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/get_integer_type_from_type().(ty: &synrust-analyzer cargo syn 2.0.104 crate/::Typerust-analyzer cargo syn 2.0.104 ty/Type#) -> IntegerTyperust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType# { |
| 36 | match &*rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String][Deref]deref().get_type_identrust-analyzer cargo bitfields-impl 1.0.0 parsing/types/get_type_ident().(ty).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().() { |
| 37 | "u8" => U8rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U8#, |
| 38 | "u16" => U16rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U16#, |
| 39 | "u32" => U32rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U32#, |
| 40 | "u64" => U64rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U64#, |
| 41 | "u128" => U128rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U128#, |
| 42 | "usize" => Usizerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#Usize#, |
| 43 | "i8" => I8rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I8#, |
| 44 | "i16" => I16rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I16#, |
| 45 | "i32" => I32rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I32#, |
| 46 | "i64" => I64rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I64#, |
| 47 | "i128" => I128rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I128#, |
| 48 | "isize" => Isizerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#Isize#, |
| 49 | "bool" => Boolrust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#Bool#, |
| 50 | _ => UnknownIntegerrust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#UnknownInteger#, |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | /// Returns the integer suffix from the integer type. |
| 55 | pub(craterust-analyzer cargo bitfields-impl 1.0.0 crate/) fn get_integer_suffix_from_integer_typerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/get_integer_suffix_from_integer_type().( |
| 56 | integer_type: IntegerTyperust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#, |
| 57 | ) -> synrust-analyzer cargo syn 2.0.104 crate/::Resultrust-analyzer cargo syn 2.0.104 error/Result#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> { |
| 58 | match integer_type { |
| 59 | U8rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U8# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#("u8".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), |
| 60 | U16rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U16# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#("u16".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), |
| 61 | U32rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U32# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#("u32".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), |
| 62 | U64rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U64# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#("u64".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), |
| 63 | U128rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#U128# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#("u128".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), |
| 64 | Usizerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#Usize# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#("usize".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), |
| 65 | I8rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I8# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#("i8".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), |
| 66 | I16rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I16# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#("i16".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), |
| 67 | I32rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I32# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#("i32".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), |
| 68 | I64rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I64# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#("i64".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), |
| 69 | I128rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#I128# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#("i128".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), |
| 70 | Isizerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#Isize# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#("isize".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), |
| 71 | Boolrust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#Bool# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#("bool".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), |
| 72 | _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(create_syn_errorrust-analyzer cargo bitfields-impl 1.0.0 create_syn_error().(Spanrust-analyzer cargo proc-macro2 1.0.95 Span#::call_siterust-analyzer cargo proc-macro2 1.0.95 impl#[Span]call_site().(), PANIC_ERROR_MESSAGErust-analyzer cargo bitfields-impl 1.0.0 generation/common/PANIC_ERROR_MESSAGE.))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | /// Returns if the type is a supported bitfield type. |
| 77 | pub(craterust-analyzer cargo bitfields-impl 1.0.0 crate/) fn is_supported_bitfield_typerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/is_supported_bitfield_type().(ty: &synrust-analyzer cargo syn 2.0.104 crate/::Typerust-analyzer cargo syn 2.0.104 ty/Type#) -> bool { |
| 78 | SUPPORTED_BITFIELD_TYPESrust-analyzer cargo bitfields-impl 1.0.0 parsing/types/SUPPORTED_BITFIELD_TYPES..containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&get_integer_type_from_typerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/get_integer_type_from_type().(ty)) |
| 79 | } |
| 80 | |
| 81 | /// Returns if the type is a supported bitfield field type. |
| 82 | pub(craterust-analyzer cargo bitfields-impl 1.0.0 crate/) fn is_supported_field_typerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/is_supported_field_type().(ty: &synrust-analyzer cargo syn 2.0.104 crate/::Typerust-analyzer cargo syn 2.0.104 ty/Type#) -> bool { |
| 83 | is_custom_field_typerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/is_custom_field_type().(ty) |
| 84 | || SUPPORTED_BITFIELD_FIELD_TYPESrust-analyzer cargo bitfields-impl 1.0.0 parsing/types/SUPPORTED_BITFIELD_FIELD_TYPES..containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&get_integer_type_from_typerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/get_integer_type_from_type().(ty)) |
| 85 | } |
| 86 | |
| 87 | /// Returns if the type is an unsigned integer type. |
| 88 | pub(craterust-analyzer cargo bitfields-impl 1.0.0 crate/) fn is_unsigned_integer_typerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/is_unsigned_integer_type().(ty: &synrust-analyzer cargo syn 2.0.104 crate/::Typerust-analyzer cargo syn 2.0.104 ty/Type#) -> bool { |
| 89 | UNSIGNED_INTEGER_TYPESrust-analyzer cargo bitfields-impl 1.0.0 parsing/types/UNSIGNED_INTEGER_TYPES..containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&get_integer_type_from_typerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/get_integer_type_from_type().(ty)) || is_bool_typerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/is_bool_type().(ty) |
| 90 | } |
| 91 | |
| 92 | /// Returns if the type is an unsigned integer type. |
| 93 | pub(craterust-analyzer cargo bitfields-impl 1.0.0 crate/) fn is_signed_integer_typerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/is_signed_integer_type().(ty: &synrust-analyzer cargo syn 2.0.104 crate/::Typerust-analyzer cargo syn 2.0.104 ty/Type#) -> bool { |
| 94 | SIGNED_INTEGER_TYPESrust-analyzer cargo bitfields-impl 1.0.0 parsing/types/SIGNED_INTEGER_TYPES..containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&get_integer_type_from_typerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/get_integer_type_from_type().(ty)) |
| 95 | } |
| 96 | |
| 97 | /// Returns if the type is an unsigned integer type. |
| 98 | pub(craterust-analyzer cargo bitfields-impl 1.0.0 crate/) fn is_bool_typerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/is_bool_type().(ty: &synrust-analyzer cargo syn 2.0.104 crate/::Typerust-analyzer cargo syn 2.0.104 ty/Type#) -> bool { |
| 99 | get_integer_type_from_typerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/get_integer_type_from_type().(ty) rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/impl#[IntegerType][`PartialEq<Self>`]eq().==rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/impl#[IntegerType][`PartialEq<Self>`]eq(). rust-analyzer cargo bitfields-impl 1.0.0 parsing/types/impl#[IntegerType][`PartialEq<Self>`]eq().Boolrust-analyzer cargo bitfields-impl 1.0.0 parsing/types/IntegerType#Bool# |
| 100 | } |
| 101 | |
| 102 | /// Returns the number of bits of the integer type. |
| 103 | pub(craterust-analyzer cargo bitfields-impl 1.0.0 crate/) fn get_bits_from_typerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/get_bits_from_type().(ty: &synrust-analyzer cargo syn 2.0.104 crate/::Typerust-analyzer cargo syn 2.0.104 ty/Type#) -> synrust-analyzer cargo syn 2.0.104 crate/::Resultrust-analyzer cargo syn 2.0.104 error/Result#<u8> { |
| 104 | match get_type_identrust-analyzer cargo bitfields-impl 1.0.0 parsing/types/get_type_ident().(ty).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().().as_strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[String]as_str().() { |
| 105 | "bool" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(1), |
| 106 | "u8" | "i8" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(8), |
| 107 | "u16" | "i16" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(16), |
| 108 | "u32" | "i32" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(32), |
| 109 | "u64" | "i64" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(64), |
| 110 | "u128" | "i128" => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(128), |
| 111 | _ => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(create_syn_errorrust-analyzer cargo bitfields-impl 1.0.0 create_syn_error().(Spanrust-analyzer cargo proc-macro2 1.0.95 Span#::call_siterust-analyzer cargo proc-macro2 1.0.95 impl#[Span]call_site().(), PANIC_ERROR_MESSAGErust-analyzer cargo bitfields-impl 1.0.0 generation/common/PANIC_ERROR_MESSAGE.))?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`][Try]branch()., |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | /// Returns if the type is a size type. |
| 116 | pub(craterust-analyzer cargo bitfields-impl 1.0.0 crate/) fn is_size_typerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/is_size_type().(ty: &synrust-analyzer cargo syn 2.0.104 crate/::Typerust-analyzer cargo syn 2.0.104 ty/Type#) -> bool { |
| 117 | SIZE_TYPESrust-analyzer cargo bitfields-impl 1.0.0 parsing/types/SIZE_TYPES..containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]contains().(&get_integer_type_from_typerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/get_integer_type_from_type().(ty)) |
| 118 | } |
| 119 | |
| 120 | /// Returns if the type is a custom field type. |
| 121 | pub(craterust-analyzer cargo bitfields-impl 1.0.0 crate/) fn is_custom_field_typerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/is_custom_field_type().(ty: &synrust-analyzer cargo syn 2.0.104 crate/::Typerust-analyzer cargo syn 2.0.104 ty/Type#) -> bool { |
| 122 | !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().is_unsigned_integer_typerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/is_unsigned_integer_type().(ty) && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().is_signed_integer_typerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/is_signed_integer_type().(ty) && !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().is_bool_typerust-analyzer cargo bitfields-impl 1.0.0 parsing/types/is_bool_type().(ty) |
| 123 | } |
| 124 | |
| 125 | /// Returns the identifier of the type. |
| 126 | pub(craterust-analyzer cargo bitfields-impl 1.0.0 crate/) fn get_type_identrust-analyzer cargo bitfields-impl 1.0.0 parsing/types/get_type_ident().(ty: &synrust-analyzer cargo syn 2.0.104 crate/::Typerust-analyzer cargo syn 2.0.104 ty/Type#) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#> { |
| 127 | if let synrust-analyzer cargo syn 2.0.104 crate/::Typerust-analyzer cargo syn 2.0.104 ty/Type#::Pathrust-analyzer cargo syn 2.0.104 ty/Type#Path#(ty) = ty { |
| 128 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(segment) = ty.pathrust-analyzer cargo syn 2.0.104 ty/TypePath#path..segmentsrust-analyzer cargo syn 2.0.104 path/Path#segments..firstrust-analyzer cargo syn 2.0.104 punctuated/impl#[`Punctuated<T, P>`]first().() { |
| 129 | return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(segment.identrust-analyzer cargo syn 2.0.104 path/PathSegment#ident..to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 134 | } |