crates/kernel/ents-attrs/src/lib.rs
| 1 | //! The `ents` attribute namespace: presentation policy declared once, on |
| 2 | //! an entity's own fields, and read generically by any surface walking its |
| 3 | //! [`facet::Shape`] — never by matching on the concrete entity type. |
| 4 | //! |
| 5 | //! A separate crate for the same reason `figue`'s own attribute crate is: |
| 6 | //! a macro-expanded `#[macro_export]` macro cannot be referred to by |
| 7 | //! absolute path from the crate that expands it, so the entity crates |
| 8 | //! (`ents-model`, `ents-forge`) could not annotate their own fields if the |
| 9 | //! grammar lived in either of them. Use as `use ents_attrs as ents;`, then |
| 10 | //! `#[facet(ents::head)]` etc. |
| 11 | |
| 12 | extern crate self as ents_attrs; |
| 13 | |
| 14 | // @relation(model.presentation, scope=file) |
| 15 | facet::define_attr_grammar! { |
| 16 | ns "ents"; |
| 17 | crate_path ::ents_attrs; |
| 18 | |
| 19 | /// Presentation roles a field declares via `#[facet(ents::...)]`. |
| 20 | pub enum Attr { |
| 21 | /// Never rendered generically: identity bound into the refname, or |
| 22 | /// domain-rendered by a bespoke line. |
| 23 | Skip, |
| 24 | /// A porcelain head-line token (values must be single words); also |
| 25 | /// a leading human list column. |
| 26 | Head, |
| 27 | /// A human list column, after the head columns. |
| 28 | Col, |
| 29 | /// Omitted from show and porcelain when the value is empty. |
| 30 | SkipEmpty, |
| 31 | /// An id value: 20 raw bytes render as hex; abbreviated in human |
| 32 | /// output, full in porcelain. |
| 33 | Id, |
| 34 | /// The message body: the last `field: value` line of show, the |
| 35 | /// tab-indented block of a porcelain record. |
| 36 | Body, |
| 37 | /// A compose field on an action variant: filled by |
| 38 | /// $GIT_EDITOR/$EDITOR when its flag is omitted. |
| 39 | Compose, |
| 40 | } |
| 41 | } |