Skip to content

Commit

Permalink
add accepted_values to constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
www committed Nov 12, 2024
1 parent bcdc71a commit d24fd8d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
24 changes: 12 additions & 12 deletions docs/src/user/templating/2-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,7 @@ An unsigned 8-bit integer. **Note: u8 arrays (`{u8}`) are often used to represen

### Constraints

- **range**: The range of values this number can take on
- **range**: The range of values this number can take on (accepted values: 0-255)

---

Expand All @@ -1094,7 +1094,7 @@ An unsigned 16-bit integer.

### Constraints

- **range**: The range of values this number can take on
- **range**: The range of values this number can take on (accepted values: 0-65535)

---

Expand All @@ -1108,7 +1108,7 @@ An unsigned 32-bit integer.

### Constraints

- **range**: The range of values this number can take on
- **range**: The range of values this number can take on (accepted values: 0-4294967295)

---

Expand All @@ -1122,7 +1122,7 @@ An unsigned 64-bit integer. **Note that most, if not all, cases of `i64` in the

### Constraints

- **range**: The range of values this number can take on
- **range**: The range of values this number can take on (accepted values: 0-18446744073709551615)

---

Expand All @@ -1136,7 +1136,7 @@ A signed 8-bit integer.

### Constraints

- **range**: The range of values this number can take on
- **range**: The range of values this number can take on (accepted values: -128-127)

---

Expand All @@ -1150,7 +1150,7 @@ A signed 16-bit integer.

### Constraints

- **range**: The range of values this number can take on
- **range**: The range of values this number can take on (accepted values: -32768-32767)

---

Expand All @@ -1164,7 +1164,7 @@ A signed 32-bit integer.

### Constraints

- **range**: The range of values this number can take on
- **range**: The range of values this number can take on (accepted values: -2147483648-2147483647)

---

Expand All @@ -1178,7 +1178,7 @@ A signed 64-bit integer. **Note that most, if not all, cases of `i64` in the act

### Constraints

- **range**: The range of values this number can take on
- **range**: The range of values this number can take on (accepted values: -9223372036854775808-9223372036854775807)

---

Expand All @@ -1192,7 +1192,7 @@ A 32-bit floating point number.

### Constraints

- **range**: The range of values this number can take on
- **range**: The range of values this number can take on (accepted values: IEEE 754 single-precision floating point)

---

Expand All @@ -1206,7 +1206,7 @@ A 64-bit floating point number.

### Constraints

- **range**: The range of values this number can take on
- **range**: The range of values this number can take on (accepted values: IEEE 754 double-precision floating point)

---

Expand All @@ -1230,7 +1230,7 @@ A single Unicode character.

### Constraints

- **length**: The length of the string
- **length**: The length of the string (accepted values: 1)

---

Expand All @@ -1244,7 +1244,7 @@ A UTF-8 encoded string.

### Constraints

- **encoding**: Accepted character encoding
- **encoding**: Accepted character encoding (accepted values: UTF-8 *only*)

---

Expand Down
5 changes: 4 additions & 1 deletion services/rust.assetgen/src/docgen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ fn generate_markdown_for_primitive(primitive: Primitive, heading_level: usize) -
}

fn primitive_constraint_to_string(p_constraint: &PrimitiveConstraint) -> String {
format!("- **{}**: {}", p_constraint.name, p_constraint.description)
format!(
"- **{}**: {} (accepted values: {})",
p_constraint.name, p_constraint.description, p_constraint.accepted_values
)
}

fn type_to_string(typ: &Type, heading_level: usize) -> String {
Expand Down

0 comments on commit d24fd8d

Please sign in to comment.