Skip to content

Step 1.9: Phantom types#10

Open
ziimakc wants to merge 1 commit intomainfrom
1_9_phantom
Open

Step 1.9: Phantom types#10
ziimakc wants to merge 1 commit intomainfrom
1_9_phantom

Conversation

@ziimakc
Copy link
Owner

@ziimakc ziimakc commented Jan 31, 2026

Resolves Step 1.9

Task

Implement a Fact<T> type which returns some random fact about T type that Fact<T> is implemented for.

let f: Fact<Vec<T>> = Fact::new();
println!("Fact about Vec: {}", f.fact());
println!("Fact about Vec: {}", f.fact());
Fact about Vec: Vec is heap-allocated.
Fact about Vec: Vec may re-allocate on growing.

Solution

Implement Fact<T> using PhantomData.

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.

1 participant