Skip to main content

with_declaration

Function with_declaration 

Source
pub fn with_declaration(
    host: &str,
    existing: &[u8],
    fn_name: &str,
    licence: &str,
    valid_from: &str,
    valid_to: Option<&str>,
) -> Result<(Vec<u8>, Declared), Error>
Expand description

The key document existing of host with a declaration (SPEC 9.2, spec-0.4.3): fn_name (a full function name under host) may be computed over inputs under the restricted licence from valid_from (an instant) until valid_to (absent: open-ended), the result carrying that licence (SPEC 8.5). Since 0.2.1.

Entries are never removed, only closed: an entry exactly as given leaves the document unchanged (so a declaration step can run again); an open entry with the same licence and valid_from, given a valid_to, is closed then; any other entry with the same licence and valid_from is refused (E_KEY_DOC), as is anything 9.2 rejects (a name under another host, a bad licence or instant, more than 64 names or 16 entries). The keys are kept as they are. The result is canonical JSON, checked by 9.2.