-
Notifications
You must be signed in to change notification settings - Fork 56
build.rs-based service declarations #72
Comments
@jonas-schievink Have you had any idea on how to integrate a callback mechanism with resources policies like the one used in RTFM ? Or even reentrancy problems when using the usual |
I think we can mostly let the user handle this if it becomes necessary. The callbacks would be called from ATT only, which is driven by the lower-priority part of the stack, so Rubble itself doesn't require any locking as long as the callbacks own their resources. I suppose we could also thread some sort of user-defined context through the |
I took a stab at this, looking at @tl8roy impl from #29 and @jonas-schievink original brainstorm in this issue. here's a playground link: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=58502f4e1189a115d895c9b27be56448 (note, this is still a bit of a sketch, as it likely doesn't implement all the things we need on services + characteristics - I only tackled some of the hard part of having a list of things without mem allocations, and using callbacks for dynamic values.) I'm not sure if we need a build.rs script to make this api work. This could be built in some init() function by the user, and map directly to Attribute structs either in ther constructors, or through some .build() function that traverses the tree. I used tuples and traits to essentially build a linked-list of different types of services+chararcteristics. This a) should be easy to write macros for, and b) lets the compiler know ahead of time the size, and types used, and allocate memory on the stack, rather than using The only things that worries me, is that Attribute in the As for the mapping between these types and |
@o080o You linked to the same gist that's already linked above |
@jonas-schievink woops, fixed that. |
In order to make defining services and characteristics easy, Rubble will likely want to provide a
build.rs
-based API that uses builder structs to define the provided services and characteristics. We can then generate highly size-optimized code containing the necessary attribute definitions, and can also enforce that all included services are present at build time.Things to figure out:
I did some brainstorming about how to store the data efficiently:
Click to expand
Playground Braindump
The text was updated successfully, but these errors were encountered: