Add tags to Rust std lib functions (#6701)
Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
@ -21,7 +21,6 @@ angledLine(
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -18,7 +18,6 @@ angledLineThatIntersects(
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -17,7 +17,6 @@ appearance(
|
||||
): [Solid] | ImportedGeometry
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -22,7 +22,6 @@ arc(
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -21,7 +21,6 @@ assert(
|
||||
): ()
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -15,7 +15,6 @@ assertIs(
|
||||
): ()
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -18,7 +18,6 @@ bezierCurve(
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -18,7 +18,6 @@ circleThreePoint(
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -16,7 +16,6 @@ Really only use this function if YOU ARE SURE you need it. In most cases you do
|
||||
clone(geometry: Solid | Sketch | ImportedGeometry): Solid | Sketch | ImportedGeometry
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -15,7 +15,6 @@ close(
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -19,7 +19,6 @@ extrude(
|
||||
): [Solid]
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -20,7 +20,6 @@ helix(
|
||||
): Helix
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Compute the absolute value of a number.
|
||||
abs(@input: number): number
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Compute the arccosine of a number.
|
||||
acos(@num: number(_)): number(rad)
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Compute the arcsine of a number.
|
||||
asin(@num: number(_)): number(rad)
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Consider using `atan2()` instead for the true inverse of tangent.
|
||||
atan(@num: number(_)): number(rad)
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -15,7 +15,6 @@ atan2(
|
||||
): number(rad)
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Compute the smallest integer greater than or equal to a number.
|
||||
ceil(@input: number): number
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Compute the cosine of a number.
|
||||
cos(@num: number(Angle)): number(_)
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Compute the largest integer less than or equal to a number.
|
||||
floor(@input: number): number
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Compute the natural logarithm of the number.
|
||||
ln(@input: number): number
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -17,7 +17,6 @@ log(
|
||||
): number
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Compute the base 10 logarithm of the number.
|
||||
log10(@input: number): number
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Compute the base 2 logarithm of the number.
|
||||
log2(@input: number): number
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Compute the maximum of the given arguments.
|
||||
max(@input: [number; 1+]): number
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Compute the minimum of the given arguments.
|
||||
min(@input: [number; 1+]): number
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -16,7 +16,6 @@ polar(
|
||||
): Point2d
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -15,7 +15,6 @@ pow(
|
||||
): number
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -16,7 +16,6 @@ rem(
|
||||
): number
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Round a number to the nearest integer.
|
||||
round(@input: number): number
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Compute the sine of a number.
|
||||
sin(@num: number(Angle)): number(_)
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Compute the square root of a number.
|
||||
sqrt(@input: number): number
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Compute the tangent of a number.
|
||||
tan(@num: number(Angle)): number(_)
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -16,7 +16,6 @@ offsetPlane(
|
||||
): Plane
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -30,7 +30,6 @@ revolve(
|
||||
): Solid
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -18,7 +18,6 @@ circle(
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -17,7 +17,6 @@ mirror2d(
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -19,7 +19,6 @@ chamfer(
|
||||
): Solid
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -20,7 +20,6 @@ fillet(
|
||||
): Solid
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -16,7 +16,6 @@ hollow(
|
||||
): Solid
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -17,7 +17,6 @@ shell(
|
||||
): [Solid]
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Convert a number to centimeters from its current units.
|
||||
units::toCentimeters(@num: number(cm)): number(cm)
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Converts a number to degrees from its current units.
|
||||
units::toDegrees(@num: number(deg)): number(deg)
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Convert a number to feet from its current units.
|
||||
units::toFeet(@num: number(ft)): number(ft)
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Convert a number to inches from its current units.
|
||||
units::toInches(@num: number(in)): number(in)
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Convert a number to meters from its current units.
|
||||
units::toMeters(@num: number(m)): number(m)
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Convert a number to millimeters from its current units.
|
||||
units::toMillimeters(@num: number(mm)): number(mm)
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Converts a number to radians from its current units.
|
||||
units::toRadians(@num: number(rad)): number(rad)
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Converts a number to yards from its current units.
|
||||
units::toYards(@num: number(yd)): number(yd)
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Get the shared edge between two faces.
|
||||
getCommonEdge(faces: [TagIdentifier]): Uuid
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Get the next adjacent edge to the edge given.
|
||||
getNextAdjacentEdge(edge: TagIdentifier): Uuid
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Get the opposite edge to the edge given.
|
||||
getOppositeEdge(edge: TagIdentifier): Uuid
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Get the previous adjacent edge to the edge given.
|
||||
getPreviousAdjacentEdge(edge: TagIdentifier): Uuid
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -15,7 +15,6 @@ intersect(
|
||||
): [Solid]
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -19,7 +19,6 @@ involuteCircular(
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Extract the 'x' axis value of the last line segment in the provided 2-d sketch.
|
||||
lastSegX(sketch: Sketch): number
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Extract the 'y' axis value of the last line segment in the provided 2-d sketch.
|
||||
lastSegY(sketch: Sketch): number
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -15,11 +15,6 @@ legAngX(
|
||||
): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `utilities`
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -39,3 +34,4 @@ legAngX(hypotenuse = 5, leg = 3)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
@ -15,11 +15,6 @@ legAngY(
|
||||
): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `utilities`
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -39,3 +34,4 @@ legAngY(hypotenuse = 5, leg = 3)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
@ -15,11 +15,6 @@ legLen(
|
||||
): number
|
||||
```
|
||||
|
||||
### Tags
|
||||
|
||||
* `utilities`
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
@ -39,3 +34,4 @@ legLen(hypotenuse = 5, leg = 3)
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
@ -17,7 +17,6 @@ line(
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -20,7 +20,6 @@ loft(
|
||||
): Solid
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -15,7 +15,6 @@ map(
|
||||
): [any]
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -19,7 +19,6 @@ patternCircular2d(
|
||||
): [Sketch]
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -20,7 +20,6 @@ patternCircular3d(
|
||||
): [Solid]
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -18,7 +18,6 @@ patternLinear2d(
|
||||
): [Sketch]
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -18,7 +18,6 @@ patternLinear3d(
|
||||
): [Solid]
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -43,7 +43,6 @@ patternTransform(
|
||||
): [Solid]
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -17,7 +17,6 @@ patternTransform2d(
|
||||
): [Sketch]
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -18,7 +18,6 @@ polygon(
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Returns a new array with the last element removed.
|
||||
pop(array: [any]): any
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Extract the provided 2-dimensional sketch's profile's origin value.
|
||||
profileStart(profile: Sketch): [number]
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Extract the provided 2-dimensional sketch's profile's origin's 'x' value.
|
||||
profileStartX(profile: Sketch): number
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Extract the provided 2-dimensional sketch's profile's origin's 'y' value.
|
||||
profileStartY(profile: Sketch): number
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -15,7 +15,6 @@ push(
|
||||
): any
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -16,7 +16,6 @@ reduce(
|
||||
): any
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -38,7 +38,6 @@ rotate(
|
||||
): [Solid] | [Sketch] | ImportedGeometry
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -24,7 +24,6 @@ scale(
|
||||
): [Solid] | [Sketch] | ImportedGeometry
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Compute the angle (in degrees) of the provided line segment.
|
||||
segAng(tag: TagIdentifier): number
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Compute the ending point of the provided line segment.
|
||||
segEnd(tag: TagIdentifier): Point2d
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Compute the ending point of the provided line segment along the 'x' axis.
|
||||
segEndX(tag: TagIdentifier): number
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Compute the ending point of the provided line segment along the 'y' axis.
|
||||
segEndY(tag: TagIdentifier): number
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Compute the length of the provided line segment.
|
||||
segLen(tag: TagIdentifier): number
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Compute the starting point of the provided line segment.
|
||||
segStart(tag: TagIdentifier): Point2d
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Compute the starting point of the provided line segment along the 'x' axis.
|
||||
segStartX(tag: TagIdentifier): number
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Compute the starting point of the provided line segment along the 'y' axis.
|
||||
segStartY(tag: TagIdentifier): number
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -16,7 +16,6 @@ startProfile(
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -23,7 +23,6 @@ startSketchOn(
|
||||
): Plane | Face
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -16,7 +16,6 @@ subtract(
|
||||
): [Solid]
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -15,7 +15,6 @@ subtract2d(
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -21,7 +21,6 @@ sweep(
|
||||
): [Solid]
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -12,7 +12,6 @@ Returns the angle coming out of the end of the segment in degrees.
|
||||
tangentToEnd(tag: TagIdentifier): number
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -19,7 +19,6 @@ tangentialArc(
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -20,7 +20,6 @@ translate(
|
||||
): [Solid] | [Sketch] | ImportedGeometry
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -15,7 +15,6 @@ union(
|
||||
): [Solid]
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -17,7 +17,6 @@ xLine(
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -17,7 +17,6 @@ yLine(
|
||||
): Sketch
|
||||
```
|
||||
|
||||
|
||||
### Arguments
|
||||
|
||||
| Name | Type | Description | Required |
|
||||
|
@ -232,30 +232,16 @@ fn do_stdlib_inner(
|
||||
quote! { "" }
|
||||
};
|
||||
|
||||
let cb = doc_info.code_blocks.clone();
|
||||
let code_blocks = if !cb.is_empty() {
|
||||
quote! {
|
||||
let code_blocks = vec![#(#cb),*];
|
||||
code_blocks.iter().map(|cb| {
|
||||
let program = crate::Program::parse_no_errs(cb).unwrap();
|
||||
|
||||
let mut options: crate::parsing::ast::types::FormatOptions = Default::default();
|
||||
options.insert_final_newline = false;
|
||||
program.ast.recast(&options, 0)
|
||||
}).collect::<Vec<String>>()
|
||||
}
|
||||
} else {
|
||||
if doc_info.code_blocks.is_empty() {
|
||||
errors.push(Error::new_spanned(
|
||||
&ast.sig,
|
||||
"stdlib functions must have at least one code block",
|
||||
));
|
||||
|
||||
quote! { vec![] }
|
||||
};
|
||||
}
|
||||
|
||||
// Make sure the function name is in all the code blocks.
|
||||
for code_block in doc_info.code_blocks.iter() {
|
||||
if !code_block.contains(&name) {
|
||||
if !code_block.0.contains(&name) {
|
||||
errors.push(Error::new_spanned(
|
||||
&ast.sig,
|
||||
format!(
|
||||
@ -270,9 +256,28 @@ fn do_stdlib_inner(
|
||||
.code_blocks
|
||||
.iter()
|
||||
.enumerate()
|
||||
.map(|(index, code_block)| generate_code_block_test(&fn_name_str, code_block, index))
|
||||
.map(|(index, (code_block, norun))| {
|
||||
if !norun {
|
||||
generate_code_block_test(&fn_name_str, code_block, index)
|
||||
} else {
|
||||
quote! {}
|
||||
}
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
let (cb, norun): (Vec<_>, Vec<_>) = doc_info.code_blocks.into_iter().unzip();
|
||||
let code_blocks = quote! {
|
||||
let code_blocks = vec![#(#cb),*];
|
||||
let norun = vec![#(#norun),*];
|
||||
code_blocks.iter().zip(norun).map(|(cb, norun)| {
|
||||
let program = crate::Program::parse_no_errs(cb).unwrap();
|
||||
|
||||
let mut options: crate::parsing::ast::types::FormatOptions = Default::default();
|
||||
options.insert_final_newline = false;
|
||||
(program.ast.recast(&options, 0), norun)
|
||||
}).collect::<Vec<(String, bool)>>()
|
||||
};
|
||||
|
||||
let tags = metadata
|
||||
.tags
|
||||
.iter()
|
||||
@ -534,7 +539,7 @@ fn do_stdlib_inner(
|
||||
#feature_tree_operation
|
||||
}
|
||||
|
||||
fn examples(&self) -> Vec<String> {
|
||||
fn examples(&self) -> Vec<(String, bool)> {
|
||||
#code_blocks
|
||||
}
|
||||
|
||||
@ -577,7 +582,7 @@ fn get_crate(var: Option<String>) -> proc_macro2::TokenStream {
|
||||
struct DocInfo {
|
||||
pub summary: Option<String>,
|
||||
pub description: Option<String>,
|
||||
pub code_blocks: Vec<String>,
|
||||
pub code_blocks: Vec<(String, bool)>,
|
||||
}
|
||||
|
||||
fn extract_doc_from_attrs(attrs: &[syn::Attribute]) -> DocInfo {
|
||||
@ -597,21 +602,22 @@ fn extract_doc_from_attrs(attrs: &[syn::Attribute]) -> DocInfo {
|
||||
});
|
||||
|
||||
// Parse any code blocks from the doc string.
|
||||
let mut code_blocks: Vec<String> = Vec::new();
|
||||
let mut code_block: Option<String> = None;
|
||||
let mut code_blocks: Vec<(String, bool)> = Vec::new();
|
||||
let mut code_block: Option<(String, bool)> = None;
|
||||
let mut parsed_lines = Vec::new();
|
||||
for line in raw_lines {
|
||||
if line.starts_with("```") {
|
||||
if let Some(ref inner_code_block) = code_block {
|
||||
code_blocks.push(inner_code_block.trim().to_string());
|
||||
if let Some((inner_code_block, norun)) = code_block {
|
||||
code_blocks.push((inner_code_block.trim().to_owned(), norun));
|
||||
code_block = None;
|
||||
} else {
|
||||
code_block = Some(String::new());
|
||||
let norun = line.contains("kcl,norun") || line.contains("kcl,no_run");
|
||||
code_block = Some((String::new(), norun));
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
if let Some(ref mut code_block) = code_block {
|
||||
if let Some((code_block, _)) = &mut code_block {
|
||||
code_block.push_str(&line);
|
||||
code_block.push('\n');
|
||||
} else {
|
||||
@ -619,8 +625,8 @@ fn extract_doc_from_attrs(attrs: &[syn::Attribute]) -> DocInfo {
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(code_block) = code_block {
|
||||
code_blocks.push(code_block.trim().to_string());
|
||||
if let Some((code_block, norun)) = code_block {
|
||||
code_blocks.push((code_block.trim().to_string(), norun));
|
||||
}
|
||||
|
||||
let mut summary = None;
|
||||
|
@ -138,17 +138,19 @@ impl crate::docs::StdLibFn for SomeFn {
|
||||
false
|
||||
}
|
||||
|
||||
fn examples(&self) -> Vec<String> {
|
||||
fn examples(&self) -> Vec<(String, bool)> {
|
||||
let code_blocks = vec!["someFn()"];
|
||||
let norun = vec![false];
|
||||
code_blocks
|
||||
.iter()
|
||||
.map(|cb| {
|
||||
.zip(norun)
|
||||
.map(|(cb, norun)| {
|
||||
let program = crate::Program::parse_no_errs(cb).unwrap();
|
||||
let mut options: crate::parsing::ast::types::FormatOptions = Default::default();
|
||||
options.insert_final_newline = false;
|
||||
program.ast.recast(&options, 0)
|
||||
(program.ast.recast(&options, 0), norun)
|
||||
})
|
||||
.collect::<Vec<String>>()
|
||||
.collect::<Vec<(String, bool)>>()
|
||||
}
|
||||
|
||||
fn std_lib_fn(&self) -> crate::std::StdFn {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user