@@ -36,17 +36,18 @@ Example:
3636
3737#include_code as_array noir_stdlib/src/meta/typ.nr rust
3838
39- If this type is an array, return a pair of (element type, size type).
39+ If this type is an array, returns an ` ArrayType ` . Use ` element_type() ` to get the type of
40+ each array element and ` length_type() ` to get the numeric-constant type describing its length.
4041
4142Example:
4243
4344``` rust
4445comptime {
4546 let array_type = quote { [Field ; 3 ] }. as_type ();
46- let ( field_type , three_type ) = array_type . as_array (). unwrap ();
47+ let array = array_type . as_array (). unwrap ();
4748
48- assert (field_type . is_field ());
49- assert_eq (three_type . as_constant (). unwrap (), 3 );
49+ assert (array . element_type () . is_field ());
50+ assert_eq (array . length_type () . as_constant (). unwrap (), 3 );
5051}
5152```
5253
@@ -61,8 +62,8 @@ return the numeric constant.
6162
6263#include_code as_integer noir_stdlib/src/meta/typ.nr rust
6364
64- If this is an integer type, return a boolean which is ` true `
65- if the type is signed, as well as the number of bits of this integer type .
65+ If this is an integer type, returns an ` IntegerType ` . Its ` is_signed() ` method reports
66+ whether the type is signed, and ` bits() ` returns its bit width .
6667
6768### as_mutable_reference
6869
@@ -86,8 +87,8 @@ If this is a `str<N>` type, returns the length `N` as a type.
8687
8788#include_code as_data_type noir_stdlib/src/meta/typ.nr rust
8889
89- If this is a struct or enum type, returns the type definition in addition to
90- any generic arguments on this type .
90+ If this is a struct or enum type, returns a ` DataType ` . Use ` definition() ` to get its
91+ ` TypeDefinition ` and ` generics() ` to get the concrete generic arguments applied to it .
9192
9293### as_tuple
9394
@@ -165,6 +166,7 @@ fn foo<T>() where T: Default {
165166impl Eq for Type
166167impl Hash for Type
167168```
169+
168170Note that this is syntactic equality, this is not the same as whether two types will type check
169171to be the same type. Unless type inference or generics are being used however, users should not
170172typically have to worry about this distinction unless ` std::meta::typ::fresh_type_variable ` is used.
0 commit comments