Skip to content

Mega rework - #68

Merged
cyypherus merged 112 commits into
mainfrom
experiment
Apr 22, 2026
Merged

Mega rework#68
cyypherus merged 112 commits into
mainfrom
experiment

Conversation

@cyypherus

@cyypherus cyypherus commented Mar 8, 2026

Copy link
Copy Markdown
Owner

Rewrites the library

Notable changes:

Recursive -> Iterative Traversal

  • To remove the possibility of stack overflow on deep trees, backer now does zero recursion during layout.
  • This might also contribute performance gains as well? Not sure, honestly
  • Resolves Use iteration in place of recursion #65

Significant Performance Gains for Large Trees

  • Before, passes didn't scale well & had unclear time complexity
  • With this PR, tree passes are very clear. Backer performs two iterations of one upwards pass & one downwards pass to finalize a layout.

Attach over / Attach under -> Inertness

  • The attach functions are removed, instead, a more powerful, composable inertness api has been added.
  • Attachment was always used to force layout to ignore certain nodes, and have those nodes passively use area available to them. Moving to inertness more accurately represents the core utility of attachment, adding many new possibilities including inertness along specific axes or in rows / columns.
  • For example - if you want a node to take up as much space as the tallest item in a row, without giving the row an unconstrained height, now you can do that!
  • To recreate attach under / over, you simply use a stack, marking the attached node as inert. Inertness prevents nodes from being considered during constraint calculation along both axes or a specific axis.

Generics & Lifetimes Changed

  • Backer layouts now produce values for each draw node, rather than performing work with mutable access inline. The generic D is the type of value that will be produced when you layout your tree.
  • Backer layouts now have access to a global, mutable context object - the generic S. This value is shared by the entire tree & can be used for things like text layout caches
  • There's a lifetime in the interface now 😵, this lifetime is the lifetime of the draw closures. Exposing this in the interface allows draw closures to borrow state from the environment with more flexibility.

Layers Added

AreaReader Removed

  • Area readers turned out to be unnecessary complexity which caused lifetime problems, forcing 'static.
  • One can now accomplish the exact same thing using a draw node, which constructs a Layout, calls Layout::draw, and returns the resulting Vec<D>
  • This approach maintains the constraint barrier which prevents cyclical layout dependencies between parent & child, & simplifies the library.

@cyypherus cyypherus changed the title Huge rework Mega rework Mar 8, 2026
@pszsh

pszsh commented Apr 11, 2026

Copy link
Copy Markdown

Just wanted to say thanks. I've been heavily leaning on your project for examples of how to build my own project, a mixed media renderer and editor. Something in between a markdown note editor, a REPL and a spreadsheet program. Not gonna lie, it's pretty epic. But this specific PR has become my guiding light, my North Star. So, thanks and whatnot.

image

Swhoops. afformentioned cool icon ;F

Untitled

here's what I've got so far.

@cyypherus

cyypherus commented Apr 11, 2026

Copy link
Copy Markdown
Owner Author

Just wanted to say thanks. I've been heavily leaning on your project for examples of how to build my own project, a mixed media renderer and editor. Something in between a markdown note editor, a REPL and a spreadsheet program. Not gonna lie, it's pretty epic. But this specific PR has become my guiding light, my North Star. So, thanks and whatnot.

Swhoops. afformentioned cool icon ;F

here's what I've got so far.

Hey that's cool to hear, shame I don't have much time to work on this lately. I'd be interested to hear some more about your project if you have any interest in chatting. If you'd like, jump into the discord server here, it's where I share some of my work.

@pszsh

pszsh commented Apr 15, 2026

Copy link
Copy Markdown

Ohey, thanks. I did join it, I made a discord and everything. I haven't ever used it, I have difficulty with socializing much. But I would love to share the project with some people at this point. It's REALLY GOOD now!!! I'm not sure what kind of stuff you're into, but I designed it to fit me like a pair of shoes. The only thing is, I really managed to do it this time. Something just clicked this time as far as Rust and ICED goes and I just had a sort of epic vision of the whole compositor system and how it needed to work. It turned out great.

I make a lot of shit, but this is the first thing I've made where I really felt strongly that others would like it [almost] as much as I do. It's novel and extremely useful, and pretty well polished and tested at this point. It's replaced my other text editors and note taking apps. Well, aside from vim. But vim is just THERE you know, but on one level of the OS.

I felt I needed something between vim and the IDE... something that wasn't a fucking webapp (VS Code) and something that wasn't just a hacked together conglomeration of plugins, which, though refined, is ultimately what my shell editor amounts to.

Sorry. Didn't mean to start writing my novel right here. I'm just eager to share it at this point and see what suggestions others have. I've fleshed out a whole system of useful utilities for those who do ECE and their daily work involves lots of SPICE notated values but formulas that expect scientific notation. I wrote some other neat utilities in the realm of math and engineering, my favorite is one in which you can take any existing function, for example,

fn L(f: Hz, c: F) -> H {
                         
    return 1 / (((2pi * f)^2) * c)
}

then, say you need to solve for f instead of L, well, you can do so easily like this:

use spice

// In "Cordial," types can be arbitrary and are therefore assumed to be units if "spice" is used. 
fn L(f: Hz, c: F) -> H { // While these each are recognized ECE types by "spice," 
                         // one could use x: C for Coulombs, it will append the unit arbitrarily.
    return 1 / (((2pi * f)^2) * c)
}

// This makes the most sense to people with some math experience, it's somewhere in between mirroring
let fx(L, c) = f where L(f, c) = L
// But I personally wanted a cleaner shorthard, so, this does the exact same thing as the first version.
let f0 = solve!(f, L) // Algebra conventions and rust conventions... All of Cordial is somewhere in between being rust-like
                            // and algebra-like, I tried to take the best from both and split the difference or just added two methods
                            // for a lot of things, such as this one. My goal was to have a familiar method for both the math folks and the programming folks.
                            
// This is where the fun begins. Evaluation follows this format everywhere in the program.                            
/= L(1000, 22n) // H means Henries, if ECE isn't your thing, the point is that the output format was meant to be in H, and thus, it is.1.15H
// Let's validate it:
/= f0(1.15H, 22n) // Well... It seems I must have recently broken the unit carry on solve!(d) function assignments.1000.5985542772
                  // Oh well, I'll fix it ;D 
                  // But you get the idea. It gave the correct result; the value that was put in originally.
image

And, gosh, there's just so much more to it. I guess what I am asking you is, where should I share this in the server? I'll be honest, I find Discord extremely overwhelming. It's like every element is simultaneously trying to draw my full attention to it. But if I knew the direct place/subserver or whatever it is called within your server, I would love to go there and chat with those folks. Sorry if this is a silly or childish or selfish thing to ask/post. I'm lacking in my perceptive skills. But I hope I'm not asking for too much or bothering youl

@cyypherus
cyypherus merged commit 6b0eec5 into main Apr 22, 2026
6 checks passed
@cyypherus
cyypherus deleted the experiment branch April 22, 2026 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Z-index (or another method for controlling draw order) Use iteration in place of recursion

2 participants