GoSuB Browser Progress, pt35

Created at 2024-09-09 08:23:42 (2 months ago)

I'm currently working on some refactoring in order to get something trivial working (html5 and css3 crate depend on each other, and results in a cyclic dependency).. I'm trying to fix this by creating some generic traits in gosub_shared so both html5 and css3 can reference them without stuff breaking. That almost works, but the whole Traits/Generics are new to me so I'm a bit struggling getting things right.

Having a generic Document trait, means we also need some Node traits, which in turn needs some other traits and the whole things gets filled up pretty fast. The biggest issue I have now is that a node can be an ElementNode (things like < div > < a> etc), which in turn has all kind of data (attributes, classes etc). Since both html5 and css3 crates needs this, I must define in it in a trait, which results in all kind of trouble. I've tried to come up with a smaller example: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=9dd09ea3f069aa9069c81dbf1cebeb70

Either i'm almost there and just need to fix a few small things.... or everything is complete wrong and I need to build this from scratch.. still figuring out which one it is..

gosub generics traits rust

About jaytaph

Codemuser extraordinaire

avatar Loves building crazy and insane stuff. Happiest when left alone. All I wanted was a Pepsi, just a Pepsi.
Joined:March 24, 2023
Following:2
Followers:2
Posts:50
Comments:3
Upvotes:4
RSS feed