Function cloneWithDifferentAllocator [src]
Prototype
pub fn cloneWithDifferentAllocator(other: Managed, allocator: Allocator) !Managed
Parameters
other: Managed
allocator: Allocator
Source
pub fn cloneWithDifferentAllocator(other: Managed, allocator: Allocator) !Managed {
return Managed{
.allocator = allocator,
.metadata = other.metadata,
.limbs = block: {
const limbs = try allocator.alloc(Limb, other.len());
@memcpy(limbs, other.limbs[0..other.len()]);
break :block limbs;
},
};
}