Skip to content

Document ({ /* arbitrary Rust code */ }) #72

Closed
@trombonehero

Description

@trombonehero

I wasn't able to find anything in the Maud documentation about the fact that splices can contain arbitrary Rust code, including compound expressions. I did stumble on #11, which contains a comment referencing ${ ... } before I created a bug about type inference, but it would be useful if the documentation had an example of this kind of thing. For instance:

p ({
  let user:User = try![database.lookup(userid)];
  user.name
})

This is also an example of the kind of thing that can fail when using Maud @let directives: they don't accept type annotations, so I sometimes get "the type of this value must be known in this context" errors.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions