This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fn main() { | |
| for int::range(1,101) |i| { | |
| io::println(option::get_default(Some("foo"), i.to_str())); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fizzbuzz.rs:16:53: 16:64 error: illegal borrow: borrowed value does not live long enough | |
| fizzbuzz.rs:16 io::println(option::get_default(Some("foo"), i.to_str())); | |
| ^~~~~~~~~~~ | |
| note: borrowed pointer must be valid for the static lifetime... | |
| fizzbuzz.rs:16:20: 16:65 note: ...but borrowed value is only valid for the call at 16:20 | |
| fizzbuzz.rs:16 io::println(option::get_default(Some("foo"), i.to_str())); | |
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // New way | |
| trait OwnedStrRhs<S> { | |
| pure fn add_to_owned_str(lhs: ~str) -> S; | |
| } | |
| //impl<S, R: OwnedStrRhs<S>> ~str : Add<R, S> { | |
| impl<R: OwnedStrRhs<~str>> ~str : Add<R, ~str> { | |
| pure fn add(rhs: &R) -> ~str { | |
| rhs.add_to_owned_str(self) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /media/linhaus/rust/src/libcore/float.rs:154:15: 154:47 error: failed to find an im | |
| plementation of trait @str::traits::OwnedStrRhs<~str> for <V53> | |
| /media/linhaus/rust/src/libcore/float.rs:154 racc = uint::str(adjusted_digi | |
| t) + racc; | |
| ^~~~~~~~~~~~~~~~~~~~~~~ | |
| ~~~~~~~~~ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| use int::range; | |
| use option::{get_default, opt_if}; | |
| fn main() { | |
| for range(1,101) |i| { | |
| io::println(get_default( | |
| (if i % 3 == 0 { Some(~"Fizz") } else { None } + | |
| if i % 5 == 0 { Some(~"Buzz") } else { None }), | |
| i.to_str() | |
| )); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // THIS CODE IS SOOO OBSOLETE. SUITABLE ONLY FOR HISTORICAL CURIOSITY | |
| use int::range; | |
| use option::get_default; | |
| fn main() { | |
| for range(1,101) |i| { | |
| io::println(get_default( | |
| (if i % 3 == 0 { Some(~"Fizz") } else { None } + | |
| if i % 5 == 0 { Some(~"Buzz") } else { None }), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| trait A {} | |
| impl ~[int] : A {} | |
| fn foo()-> A { | |
| ~[0] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| https://groups.google.com/d/msg/net.bugs/ZGlqGwNaq3I/JX6mYJRPg34J | |
| D Gary Grady | |
| 1/22/85 | |
| <> | |
| > The problem won't be the computers, but the software. Some software is | |
| > bound to be wrong, only considering the last two digits of the year. | |
| And thereby hangs a tale: In 1978, when I was working in banking, I | |
| ran across a curious date storage format. It seems that transaction |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| impl<T: Copy Add<T,T>> Option<T> : Add<Option<T>, Option<T>> { | |
| #[inline(always)] | |
| pure fn add(other: &Option<T>) -> Option<T> { | |
| match (self, *other) { | |
| (None, None) => None, | |
| (_, None) => self, | |
| (None, _) => *other, | |
| (Some(ref v1), Some(ref v2)) => Some(*v1 + *v2) | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| F ARMstF1 IF E K Disk Rename(ARMST:RARMST) | |
| D pCusNo S 6p 0 | |
| D pName S 30a | |
| D pAddr1 S 30a | |
| D pAddr2 S 30a | |
| D pCity S 25a | |
| D pState S 2a | |
| D pZip S 10a |