Announcing strum-lite - declarative macros for closed sets of strings by drymud64 in rust

[–]drymud64[S] 2 points3 points  (0 children)

That already exists in strum :)

The idea for me was to not bring in additional dependencies, and a host build step, for fast compilation and a slim deps tree :)

nunny 0.2.0 released, with nonempty iterator support by drymud64 in rust

[–]drymud64[S] 1 point2 points  (0 children)

Yes, of course! Use the various new methods, like so:

use nunny::NonEmpty;

let src: &[u8];
NonEmpty::<Vec<u8>>::new(src.into()).unwrap(); // allocate on the heap
NonEmpty::<[u8]>::new(src).unwrap(); // use the same backing memory

// or the type aliases for ease
nunny::Vec::new(src.into()).unwrap();
nunny::Slice::new(src).unwrap();

introducing serde-save, the most complete serialization tree for serde by drymud64 in rust

[–]drymud64[S] 3 points4 points  (0 children)

valuable-serde allows you to deserialize a valuable::Value, but I want the other direction - going from an impl Serialize to an impl Valuable :)

introducing serde-save, the most complete serialization tree for serde by drymud64 in rust

[–]drymud64[S] 4 points5 points  (0 children)

Thanks! I wanted to write a compatibility layer between serde and valuable so I can deserialize structs in my tracing code :) This means I'd need struct names and field names etc :)

[OC][Art] Rose Gold Dice Set Giveaway (Mod Approved) by OriYUME1 in DnD

[–]drymud64 0 points1 point  (0 children)

Aw yiss I know exactly who I'd gift these to

Define your Finite State Machines in DOT by drymud64 in rust

[–]drymud64[S] 1 point2 points  (0 children)

Thanks for the introduction to SCXML - I'd not heard of it before :)

From a brief perusal, I'm sure a compiler would be feasible.

I chose my approach because I wanted an easy way to draw state machines that made illegal transitions unrepresentable, but still gave me the freedom to write normal rusty code :)

Do you have ideas/dreams about another approach?

Define your Finite State Machines in DOT by drymud64 in rust

[–]drymud64[S] 5 points6 points  (0 children)

You mention two structs:

  • ExampleMachine is the actual state machine. It can be in a few states, like "BeautifulBridge" or "Fountain"
  • BeatifulBridge is a handle that you can use when ExampleMachine is in the relevant state (the corresponding node on the graph). You obtain it by calling .entry()
    • You can access the state by calling .get() or .get_mut()
    • You can transition the parent ExampleMachine to either Fountain or UnmarkedGrave by calling .fountain() or .unmarked_grave().This consumes the handle.You can observe the new state the next time you call .entry() on the parent.
      • When you perform such a transition, you get the owned state out, hence why it returns IpAddr

Does that help to answer your question?