Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Introduce aUnits trait#855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
nicoburns wants to merge3 commits intomain
base:main
Choose a base branch
Loading
fromunits
Draft

Introduce aUnits trait#855

nicoburns wants to merge3 commits intomainfromunits

Conversation

nicoburns
Copy link
Collaborator

@nicoburnsnicoburns commentedAug 1, 2025
edited
Loading

Objective

Introduce an abstraction that allows "the whole of Taffy" to be generic over multiple types with only one generic parameter.

The core of this change is the introduction of:

/// Allows Taffy to abstract of the types it uses to represent strings and calc expressions./// In future it may be extended to abstract the scalar number type (currently f32)pubtraitUnits{/// Trait that represents a cheaply clonable string. If you're unsure what to use here/// consider `Arc<str>` or `string_cache::Atom`.typeStr:CheapCloneStr;/// Type representing a calc expression./// If you're not using Calc then you can just use `()`typeCalc:'static;}pubstructDefaultUnits;implUnitsforDefaultUnits{typeStr =String;typeCalc =();}

Context

Feedback wanted

Is this a sensible change or am I going overboard with the generic types?

PPakalns reacted with heart emoji
@nicoburnsnicoburns added code qualityMake the code cleaner or prettier. controversialThis work requires a heightened standard of review due to implementation or design complexity labelsAug 1, 2025
typeCalc:Calc;
}

/// A default implementation of the [`Units`] trait
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should note that it has no specific semantic value.

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

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

What do you mean by "semantic value"?

Copy link
Collaborator

@alice-i-cecilealice-i-cecile left a comment

Choose a reason for hiding this comment

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

Seems reasonable. I think the semantics are clearer and I don't mind the added generics.

nicoburns, PPakalns, and domenkozar reacted with thumbs up emojiPPakalns and domenkozar reacted with heart emoji
Signed-off-by: Nico Burns <nico@nicoburns.com>
Signed-off-by: Nico Burns <nico@nicoburns.com>
Signed-off-by: Nico Burns <nico@nicoburns.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@alice-i-cecilealice-i-cecilealice-i-cecile left review comments

Assignees

No one assigned

Labels

code qualityMake the code cleaner or prettier.controversialThis work requires a heightened standard of review due to implementation or design complexity

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@nicoburns@alice-i-cecile

[8]ページ先頭

©2009-2025 Movatter.jp