Skip to content

Lifetime refactor & crate update#1

Merged
DarkMrMelther merged 15 commits into
Steel-Foundation:devfrom
suprohub:minimessage
Jun 12, 2026
Merged

Lifetime refactor & crate update#1
DarkMrMelther merged 15 commits into
Steel-Foundation:devfrom
suprohub:minimessage

Conversation

@suprohub

@suprohub suprohub commented May 3, 2026

Copy link
Copy Markdown

This PR introduces lifetime annotations and ownership traits to the core component system, improving flexibility and enabling zero-copy deserialization where possible.

Added

  • RawTextComponent<'a> generic over the lifetime of borrowed data.
  • Optional ownable feature with IntoOwned and ToOwned derives for converting between borrowed and owned variants.
  • Optional databake feature for bakeable (const-friendly) component structures.
  • Type alias TextComponent = RawTextComponent<'static> preserving the previous API for owned use cases.

Changed

  • Renamed TextComponentRawTextComponent<'a> throughout the entire crate.
  • All dependent types (Content, Format, Interactivity, TranslatedMessage, ClickEvent, HoverEvent, NbtSource, Object, ObjectPlayer, PlayerProperties, Resolvable) now carry a lifetime parameter.
  • Updated SNBT and NBT parsers to work with the new generic structures.
  • Adapted builder traits (Modifier) and BuildTarget / TextResolutor to support lifetime‑aware components.
  • Adjusted build.rs translation macro to generate constants compatible with the new API.
  • Updated examples, tests, and documentation to reflect the changes.

Fixed

  • No runtime overhead for owned components ('static): the new TextComponent alias works exactly as before.
  • Resolutors and builders now correctly handle both borrowed and owned data.

Dependencies

  • Added ownable, databake as optional dependencies.
  • Updated minor version bounds for existing dependencies only as needed.

@suprohub suprohub marked this pull request as ready for review May 4, 2026 18:59
@suprohub suprohub changed the title MiniMessage integration MiniMessage integration and lifetime refactor May 9, 2026

@DarkMrMelther DarkMrMelther left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello! Thanks for the PR and the patience waiting till the review. The life time refactor seems great, good job, but we should move the MiniMessage integration into another PR, some changes should be made before adding MiniMsg format to the lib, talking specifically of your library, the constructor "minimessage" should be named "from_minimsg" since comes from another format, and should be placed in the minimsg crate, also to avoid having too many empty components we should have a final step that reorders components based on their styles or something similar, also to add the gradient tags we should add first the custom component types, and discuss with 4lve about server-side translations, since they are needed to add gradients for translated texts.

@suprohub

suprohub commented Jun 9, 2026

Copy link
Copy Markdown
Author

Hello! Thanks for the PR and the patience waiting till the review. The life time refactor seems great, good job, but we should move the MiniMessage integration into another PR, some changes should be made before adding MiniMsg format to the lib, talking specifically of your library, the constructor "minimessage" should be named "from_minimsg" since comes from another format, and should be placed in the minimsg crate, also to avoid having too many empty components we should have a final step that reorders components based on their styles or something similar, also to add the gradient tags we should add first the custom component types, and discuss with 4lve about server-side translations, since they are needed to add gradients for translated texts.

oka

@suprohub suprohub requested a review from DarkMrMelther June 12, 2026 09:47
@suprohub suprohub changed the title MiniMessage integration and lifetime refactor Lifetime refactor & crate update Jun 12, 2026

@DarkMrMelther DarkMrMelther left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks great now! LGTM! I will merge it into a dev branch since it could break Steel if merged into Master

@DarkMrMelther DarkMrMelther changed the base branch from master to dev June 12, 2026 14:33
@DarkMrMelther DarkMrMelther merged commit 8be0b61 into Steel-Foundation:dev Jun 12, 2026
1 check passed
@suprohub suprohub deleted the minimessage branch June 13, 2026 14:14
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.

2 participants