Skip to content

Conversation

@dvaergiller
Copy link

Implement Default for Lazy<fn(&mut Buffer), C> to support using #[derive(Default)] on structs containing Lazy fields (e.g., for component children).

The default value creates an empty Lazy that renders nothing.

Implement Default for Lazy<fn(&mut Buffer<C>), C> to support using
`#[derive(Default)]` on structs containing Lazy fields (e.g., for component
children).

The default value creates an empty Lazy that renders nothing.
@dvaergiller
Copy link
Author

#166

@vidhanio vidhanio linked an issue Oct 2, 2025 that may be closed by this pull request
@adamjhf
Copy link

adamjhf commented Oct 11, 2025

Thanks! I hit this too.

@vidhanio
Copy link
Owner

I am working on a better idea for this, specifically making any Lazy<F> optional. I think it is awkward that only fn supports this.

@dvaergiller
Copy link
Author

dvaergiller commented Oct 12, 2025

Yeah I agree, I had a go trying to implement it for Lazy<F> but I could not give a default value when the type was not fully known so I thought it could not be done.

If it can, then yes that would be better.

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.

Lazy does not implement Default

3 participants