-
Notifications
You must be signed in to change notification settings - Fork 1
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix compilation errors in get_link_by_id function #8
Conversation
src/main.rs
Outdated
@@ -1,4 +1,4 @@ | |||
use doublets::{data::LinkType, mem, unit, Doublets, Error}; | |||
use doublets::{data::LinkType, mem, unit, Doublets, Error, Link}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no such type as Link
use LinkType
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@@ -1,4 +1,4 @@ | |||
use doublets::{data::LinkType, mem, unit, Doublets, Error}; | |||
use doublets::{data::LinkType, mem, unit, Doublets, Error, LinkType}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use doublets::{data::LinkType, mem, unit, Doublets, Error, LinkType}; | |
use doublets::{data::LinkType, mem, unit, Doublets, Error}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
src/main.rs
Outdated
@@ -67,7 +67,7 @@ fn nand(a: bool, b: bool) -> bool { | |||
!(a && b) | |||
} | |||
|
|||
fn get_link_by_id(store: &mut unit::Store<usize, _>, id: usize) -> Result<Link<usize>, Error<usize>> { | |||
fn get_link_by_id<T>(store: &mut unit::Store<usize, T>, id: usize) -> Result<Link<usize>, Error<usize>> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you add a type parameter also update all usages of this function to be correct. Use LinkType
instead of Link
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
src/main.rs
Outdated
fn get_link_by_id<T>(store: &mut unit::Store<usize, T>, id: usize) -> Result<Link<T>, Error<usize>> | ||
where | ||
T: LinkType, | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fn get_link_by_id<T>(store: &mut unit::Store<usize, T>, id: usize) -> Result<Link<T>, Error<usize>> | |
where | |
T: LinkType, | |
{ | |
fn get_link_by_id<T: LinkType>(store: &mut impl Doublets<T>, id: usize) -> Result<Link<T>, Error<usize>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Description
This PR fixes the compilation errors in the
get_link_by_id
function in thesrc/main.rs
file. The errors were caused by the incorrect usage of theLink
type and the placeholder_
in the function signature.Summary of Changes
Link
type from thedoublets
crate._
in the function signature ofget_link_by_id
with a type parameter.Please review and merge this PR. Thank you!
Fixes #7.
🎉 Latest improvements to Sweep:
💡 To get Sweep to edit this pull request, you can: