Skip to content

Confusing mix of references and absolutes in various function calls #163

@CowBoy4mH3LL

Description

@CowBoy4mH3LL

I see a few types (not comprehensive though) of functions defined in the library depending on their input and output
-- those with input: absolute, references, Arc
-- those with output: absolute, references, Arc

Given that, I am facing issues when using reference/Arcs outputted by some functions as arguments of others that take absolutes as inputs. Here is an example

struct Some{
_session: Arc<Session>,
...
}

fn some_new() -> Some{
  ...
  let session:Arc<session> = 
          Arc::new(
              Session::connect(user_at_server, KnownHosts::Accept)
              .await.expect("Could not connect via SSH!!")
          );
  ..
  Self{
  _session: session,
...
  }

fn some_other(){
   ...
   session.clone().close();
...
}
}
....

From the above, the compiler does not likesession.clone().close() because clone() returns another Arc and Session does not implement Copy/Clone and close() takes an absolute self as argument.

Is this an already discussed case, or am I missing something really obvious :) ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions