Comment on page
core
The core library contains intrinsics and "compiler magic" functions that get extra help from the runtime to fulfill their purpose.
enum BitfieldOrder : u8 {
LeastToMostSignificant,
LeftToRight,
MostToLeastSignificant,
RightToLeft
};
Checks if a pattern has a specific attribute assigned to it
pattern
: The pattern to checkattribute
: The attribute's name to check for
fn has_attribute(auto pattern, str attribute);
Returns the first parameter of the attribute of a pattern if it has one
pattern
: The pattern to checkattribute
: The attribute's name to query
fn get_attribute_value(auto pattern, str attribute);
Sets the current default endianess. Any patterns created following this attribute will be created using the set endianess.
endian
: The new default endianess
fn set_endian(std::mem::Endian endian);
Gets the current default endianess.
return
: The currently set default endianess
fn get_endian();
fn set_bitfield_order(std::core::BitfieldOrder order);
fn get_bitfield_order();
When used inside of a pattern that's being created using a pattern, returns the current array index that's being processed. If used outside of an array, always yields 0.
return
: The current array index
fn array_index();
Queries the number of members of a struct, union or bitfield or the number of entries in an array
pattern
: The pattern to checkreturn
: The number of members inpattern
fn member_count(auto pattern);
Checks whether or not a given pattern has a member with a given name
pattern
: The pattern to checkname
: The name of the member to look forreturn
: True if a member calledname
exists, false otherwise
fn has_member(auto pattern, str name);
Formats a pattern using it's default formatter or its custom formatter function set through the
[[format]]
or [[format_read]]
attributepattern
: The pattern to formatreturn
: Formatted string representation ofpattern
fn formatted_value(auto pattern);
Checks if the given enum value corresponds has a corresponding constant
pattern
: The enum value to checkreturn
: True if pattern has a valid enum representation, false if not
fn is_valid_enum(auto pattern);
Changes the color of the given pattern to a new color
pattern
: The pattern to modifycolor
: The RGBA8 color
fn set_pattern_color(auto pattern, u32 color);
Changes the display name of a given pattern
pattern
: The pattern to modifyname
: The new display name of the pattern
fn set_display_name(auto pattern, str name);
Last modified 8mo ago