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
= ESPAÑ4J | |
:neo4j-version: 2.3.0 | |
:author: Andrea López Suárez, Manuel Lorenzo Vega, Ricardo Soto Estévez | |
Para la realización de este trabajo hemos decidido elegir como dominio de la aplicación una representación del mapa de España, empleando sus provincias y sus relaciones fronterizas, añadiendo además que lenguas se hablan en ellas, con que mares limitan y las comunidades autónomas a la que pertenecen. | |
image::https://i.imgur.com/qZ4pkmf.jpg[] | |
image::https://i.imgur.com/n7z4dxW.jpg[] |
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::collections::HashMap; | |
pub struct StudentRecord { | |
student_id: u32, | |
marks: Vec<u8>, | |
} | |
impl StudentRecord { | |
pub fn new(student_id: u32) -> Self { | |
Self { |
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::collections::HashMap; | |
pub struct StudentRecord<T> { | |
student_id: u32, | |
marks: Vec<T>, | |
} | |
impl<T> StudentRecord<T> { | |
pub fn new(student_id: u32) -> Self { | |
Self { |
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
fn sum(numbers: &[i32]) -> i32 { | |
let mut total = numbers[0]; | |
for i in numbers.into_iter().skip(1) { | |
total += *i; | |
} | |
total | |
} | |
fn main() { | |
let numbers = vec![23, -4, 3, 10]; |
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
fn sum<T>(numbers: &[T]) -> T { | |
let mut total = numbers[0]; | |
for i in numbers.into_iter().skip(1) { | |
total = total + *i; | |
} | |
total | |
} |
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
fn sum<T>(numbers: &[T]) -> T | |
where | |
T: Add<Output = T> + Copy + Zero, | |
{ | |
let mut total: T = T::zero(); | |
for i in numbers.into_iter() { | |
total = total + *i; | |
} | |
total | |
} |
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
fn sum<T>(numbers: &[T]) -> T | |
where | |
T: Add<Output = T> + Copy, | |
{ | |
let mut total = numbers[0]; | |
for i in numbers.into_iter().skip(1) { | |
total = total + *i; | |
} | |
total | |
} |
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
fn overflow(n: i32, max: i32) -> Option<i32> { | |
if n > max { | |
Some(n - max) | |
} else { | |
None | |
} | |
} | |
fn main() { | |
let n = 15; |
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
enum ReadingError { | |
OutOfBounds, | |
InvalidBuffer | |
} | |
trait InsteadOfThis { | |
fn next_char() -> Result<u8, ReadingError>; | |
fn next_line() -> Result<String, ReadingError>; | |
fn char_at(pos: usize) -> Result<u8, ReadingError>; | |
} |
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
const TOKEN_AS_STR: &'static str = include_str!("./token.txt"); | |
const TOKEN_AS_BYTES: &[u8] = include_bytes!("./token.txt"); | |
fn main() { | |
assert_eq!("HelLoWoRLd", TOKEN_AS_STR); | |
assert_eq!("HelLoWoRLd".as_bytes(), TOKEN_AS_BYTES); | |
} |
OlderNewer