What should be the correct spelling of this line of code?

What should be the correct spelling of this line of code?

trait ServerConfig<T> {
    fn new<T>(self, item: &T) -> Self;
}

struct Server<T> {
    PositionY: T,
    PositionX: T,
}

impl<T> ServerConfig for Server<T> {
    fn new<T>(self, item: &T,) -> Self 
    {
        Server {
            PositionX: item,
            PositionY: item,
        }
    }
}


fn main()
{
    let result = Server::new(String::from("Hello"), String::from("Merhaba"));
}

Spelling?

You don't need to say <T>, the T comes from the trait definition.

2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.