tilo-actions 0.5.0

The Tilo action model: resources, the actions on them, and their registry, with the plain resource vocabulary that needs no store, search index entries included.
Documentation
1
2
3
4
5
6
7
8
9
10
11
//! What an item's address says of it.

/// The kind an item published under `resource_id` has, `<kind>.<field>`,
/// read from its id, `<kind>/<field>/<item>`; `None` for an id naming no
/// item of a top-level collection.
pub fn item_kind(resource_id: &str) -> Option<String> {
    let (collection, item) = resource_id.rsplit_once('/')?;
    let (kind, field) = collection.split_once('/')?;
    (!kind.is_empty() && !field.is_empty() && !field.contains('/') && !item.is_empty())
        .then(|| format!("{kind}.{field}"))
}