Created
February 2, 2018 13:44
-
-
Save anonymous/e46525b630abd96c3a8101f9ab45e181 to your computer and use it in GitHub Desktop.
Rust code shared from the playground
This file contains 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 std::borrow::Cow; | |
struct A<'a> { | |
geometry_column: &'a str, | |
} | |
impl<'a> A<'a> { | |
fn geometry_column_mercator(&self, flag: bool) -> Cow<str> { | |
if flag { | |
self.geometry_column.into() | |
} else { | |
String::from("Hello world!").into() | |
} | |
} | |
} | |
fn main() { | |
let a = A { | |
geometry_column: "Foo", | |
}; | |
println!("{:?}", a.geometry_column_mercator(true)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment