Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Overloaded debug string
- impl<T> fmt::Debug for Vector<T> where T: Copy + fmt::Display + num::Num {
- fn fmt(&self, f:&mut fmt::Formatter) -> fmt::Result {
- let mut s = String::new();
- s += "[";
- for i in 0..(self.vec.len()) {
- s += &format!("{}", self.vec[i]);
- if i < self.vec.len() - 1 {
- s += ", ";
- }
- }
- s += "]";
- // Write string to formatter
- write!(f, "{}", s)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement