Download rust/crates/hyperkitty-runtime/src/action.rs from Snapkitty/hyperkitty-constraint-dsl: direct link, hf CLI and curl.
- Browser
- Download file 496 Bytes
-
https://huggingface.co/Snapkitty/hyperkitty-constraint-dsl/resolve/main/rust/crates/hyperkitty-runtime/src/action.rs
- Command line
-
hf download hf://Snapkitty/hyperkitty-constraint-dsl/rust/crates/hyperkitty-runtime/src/action.rs
-
curl -L -o action.rs https://huggingface.co/Snapkitty/hyperkitty-constraint-dsl/resolve/main/rust/crates/hyperkitty-runtime/src/action.rs
496 Bytes
| pub enum Action { | |
| SetFact(String, String), | |
| RemoveFact(String), | |
| Batch(Vec<Action>), | |
| } | |
| impl Action { | |
| pub fn apply(&self, world: &mut crate::WorldState) -> hyperkitty_core::Result<()> { | |
| match self { | |
| Action::SetFact(k, v) => { world.set(k.clone(), v.clone()); Ok(()) } | |
| Action::RemoveFact(k) => { world.facts.remove(k); Ok(()) } | |
| Action::Batch(acts) => { for a in acts { a.apply(world)?; } Ok(()) } | |
| } | |
| } | |
| } | |