How ownership is transferring in same vars?

let s = String::from("hello");

let tuple = (s, s.len());

// i am confused how ownership is moving b/w same vars i.e from first s to tuple s if all s are same ,how it's working???

When you define a tuple and place another variable there, you "move" the ownership over that variable into the tuple. Also in some cases (like yours) an order is important. For example in your case, you'll have compilation error because you moved your variable into the tuple and then trying to reach it (calling s.len() when it's already moved). But on the other hand if you'll write:

let s = String::from("hello");

let tuple = (s.len(), s);

it will compile fine because you're calling s.len() while it's not in the tuple yet.

I'd like to also recommend you to read rustbook chapter about ownership, hope it will clarify some things.

and if you want to keep the ordering (s first then legnth) you can use a third variable to calculate the length before moving s.

let s = String::from("hello");

let len = s.len();
let tuple = (s, len);