-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
520 additions
and
112 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
pub fn document_primitives() -> Vec<templating_docgen::Primitive> { | ||
templating_docgen::PrimitiveListBuilder::default() | ||
.add("u8", "number", "An unsigned 8-bit integer. **Note: u8 arrays (`{u8}`) are often used to represent an array of bytes in AntiRaid**", |p| { | ||
p.add_constraint( | ||
"range", | ||
"The range of values this number can take on", | ||
&format!("0-{}", u8::MAX), | ||
) | ||
}) | ||
.add("u16", "number", "An unsigned 16-bit integer.", |p| { | ||
p.add_constraint( | ||
"range", | ||
"The range of values this number can take on", | ||
&format!("0-{}", u16::MAX), | ||
) | ||
}) | ||
.add("u32", "number", "An unsigned 32-bit integer.", |p| { | ||
p.add_constraint( | ||
"range", | ||
"The range of values this number can take on", | ||
&format!("0-{}", u32::MAX), | ||
) | ||
}) | ||
.add("u64", "number", "An unsigned 64-bit integer. **Note that most, if not all, cases of `i64` in the actual API are either `string` or the `I64` custom type from typesext**", |p| { | ||
p.add_constraint( | ||
"range", | ||
"The range of values this number can take on", | ||
&format!("0-{}", u64::MAX), | ||
) | ||
}) | ||
.add("i8", "number", "A signed 8-bit integer.", |p| { | ||
p.add_constraint( | ||
"range", | ||
"The range of values this number can take on", | ||
&format!("{}-{}", i8::MIN, i8::MAX), | ||
) | ||
}) | ||
.add("i16", "number", "A signed 16-bit integer.", |p| { | ||
p.add_constraint( | ||
"range", | ||
"The range of values this number can take on", | ||
&format!("{}-{}", i16::MIN, i16::MAX), | ||
) | ||
}) | ||
.add("i32", "number", "A signed 32-bit integer.", |p| { | ||
p.add_constraint( | ||
"range", | ||
"The range of values this number can take on", | ||
&format!("{}-{}", i32::MIN, i32::MAX), | ||
) | ||
}) | ||
.add("i64", "number", "A signed 64-bit integer. **Note that most, if not all, cases of `i64` in the actual API are either `string` or the `I64` custom type from typesext**", |p| { | ||
p.add_constraint( | ||
"range", | ||
"The range of values this number can take on", | ||
&format!("{}-{}", i64::MIN, i64::MAX), | ||
) | ||
}) | ||
.add("f32", "number", "A 32-bit floating point number.", |p| { | ||
p.add_constraint( | ||
"range", | ||
"The range of values this number can take on", | ||
"IEEE 754 single-precision floating point", | ||
) | ||
}) | ||
.add("f64", "number", "A 64-bit floating point number.", |p| { | ||
p.add_constraint( | ||
"range", | ||
"The range of values this number can take on", | ||
"IEEE 754 double-precision floating point", | ||
) | ||
}) | ||
.add("bool", "boolean", "A boolean value.", |p| p) | ||
.add("char", "string", "A single Unicode character.", |p| { | ||
p.add_constraint( | ||
"length", | ||
"The length of the string", | ||
"1", | ||
) | ||
}) | ||
.add("string", "string", "A UTF-8 encoded string.", |p| { | ||
p.add_constraint( | ||
"encoding", | ||
"Accepted character encoding", | ||
"UTF-8 *only*", | ||
) | ||
}) | ||
.build() | ||
} |
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
Oops, something went wrong.