pub fn fields<M: Model>(record: &M, item: Option<&Id>) -> Result<Value, String>Expand description
What a record holds, as the record’s own model’s JSON
(Model::to_json): every field it keeps, in the shape its own type
gives them. Name it directly as read_content on a record whose fields are
all it holds, so a caller with no window open — an agent, a script, the
SDK — reads it through the framework’s read, as it reads any app’s
record:
ⓘ
#[resource(kind = "calculator.document", read_content = tilo_resource::read::fields)]
impl Calculator {
// ...
}§Errors
A named item is not this read’s to answer: the record reads whole, and
whatever its table reads of an item is answered from the table after this
read declines it (Resource::read_content).
A record whose items it answers itself says so in a read of its own.