Itertools kmerge adding reference layer?

I presume I am doing soemthing wrong.
I construct a Vec<Vec> and make sure MyStruct supports PartialOrd.
I then call itertools kmerge with the intention of creating Vec with the entries sorted by the PartialOrd. But the compiler tells me that what kmerge produces if Vec<&MyStruct>.
I presume I am missing something obvious?
(I tried creating Vec<<Vec<&MyStruct>> but then the compiler told me kmerge was producing Vec<&&MyStruct>.)
Thanks,
Joel

It's rather hard to help you without you providing any code, but I'm guessing that you're calling .iter() on the outer Vec instead of .into_iter(). .iter() on a Vec<T> produces an iterator of &T, and when T is Vec<MyStruct>, &T is an iterator over &MyStruct instead of MyStruct.

I was hoping I had provided enough information. I am creating the NameSize things from a tree of file information. So this function recursively descends the tree, and then climbs back up assembling the sorted pieces as it goes:

    pub fn files_by_size(&self) -> Vec<NameSize> {
	if self.children.is_empty() {
	    return vec![NameSize {
		name: self.path_buf.as_path().to_str().as_ref().unwrap(),
		size: self.size,
	    }];
	}
	let myns = NameSize {
	    name: self.path_buf.as_path().to_str().as_ref().unwrap(),
	    size: self.size,
	};
	let childnss = self.children.into_iter().map(|fdata| fdata.files_by_size()).collect::<Vec<_>>();
	let mut flatten = childnss.iter().kmerge().collect::<Vec<_>>();
	// by definition the parent is larger than any child,
	// so just add it at the end
	flatten.push(myns);
	flatten
    }

And the problem is that the compiler complains that flatten.push(myns) should be flatten.push(&myns). And if I make that change, then the return type doesn't match.

Arg. I had tried to change the iter() to an into-Iter(), but I changed the wrong line. I will investigate further. Sorry to bother folks.