silk/json_array
Profiles: aarch64-apple-darwin, aarch64-unknown-linux-gnu, aarch64-unknown-linux-gnu-no-libc, wasm32-unknown-unknown, x86_64-unknown-linux-gnu, x86_64-unknown-linux-gnu-no-libc.
Effectful JSON array construction through the ambient Writer.
When to use
Use JsonArray to write a slice of values with a Serialize implementation.
Details
The array owns its comma and depth state. It does not own or borrow the Writer. A failed write can leave an accepted prefix in the Writer.
Import as JsonArray with import silk.json_array { JsonArray }.
Public declarations: 1.
JsonArray
pub struct JsonArrayOwned formatting state for one open JSON array.
Associated function JsonArray.begin
pub effect<'life0> fn begin<'life0>(options: &'life0 silk/json_output.JsonOptions) -> JsonArray ! JsonError | WriterError ? &mut WriterOpens an array after checking its depth limit.
Associated function JsonArray.items
pub effect<'env> fn items<'env, T: 'env, E, ?R>(self: once Effect<'env; silk/json_array.JsonArray ! E ? R>, values: &'env [T]) -> JsonArray ! E | JsonError | WriterError ? R | &mut WriterWrites all values in source order and returns the open array state.
Details
The incoming Effect runs once. If it fails, this operation writes nothing.
Associated function JsonArray.end
pub effect<'env> fn end<'env, E, ?R>(self: once Effect<'env; silk/json_array.JsonArray ! E ? R>) -> () ! E | JsonError | WriterError ? R | &mut WriterCloses an array and returns the completed write.
Details
The incoming Effect runs once. If it fails, the closing bracket is not written.