More doc fixes

This commit is contained in:
Alexandre Bury 2016-07-14 22:52:37 -07:00
parent b4fafbec83
commit 2ed8552e4b
3 changed files with 5 additions and 5 deletions

View File

@ -64,7 +64,7 @@ impl XY<usize> {
Vec2::new(0, self.y)
}
/// Alias for Vec::new(0,0).
/// Alias for `Vec2::new(0,0)`.
pub fn zero() -> Self {
Vec2::new(0, 0)
}

View File

@ -27,7 +27,7 @@ impl<T> XY<T> {
(self.x, self.y)
}
/// Return a XY with references to this one's values.
/// Return a `XY` with references to this one's values.
pub fn as_ref(&self) -> XY<&T> {
XY::new(&self.x, &self.y)
}
@ -45,14 +45,14 @@ impl<T> XY<T> {
}
}
/// Returns a new XY by calling `f` on `self` and `other` for each axis.
/// Returns a new `XY` by calling `f` on `self` and `other` for each axis.
pub fn zip_map<U, V, F: Fn(T, U) -> V>(self, other: XY<U>, f: F) -> XY<V> {
XY::new(f(self.x, other.x), f(self.y, other.y))
}
}
impl<T> XY<Option<T>> {
/// Returns a new XY by calling `unwrap_or` on each axis.
/// Returns a new `XY` by calling `unwrap_or` on each axis.
pub fn unwrap_or(self, other: XY<T>) -> XY<T> {
self.zip_map(other, |s, o| s.unwrap_or(o))
}

View File

@ -3,7 +3,7 @@ set -e
cargo doc
FROM=$(git rev-parse --short HEAD)
git checkout gh-pages
git fetch && git rebase
git fetch && git rebase origin/gh-pages
rsync -a target/doc/ .
git add .
git commit -m "Update doc for ${FROM}"