Implement Extends for Base

This commit is contained in:
asonix 2020-11-25 09:41:02 -06:00
parent b99daa1e1d
commit 9d34cb6e1c
3 changed files with 16 additions and 1 deletions

View file

@ -1,5 +1,8 @@
# Unreleased # Unreleased
# 0.7.0-alpha.7
- implement Extends for Base
# 0.7.0-alpha.6 # 0.7.0-alpha.6
- Add Actor and AsApActor impls for ApObject - Add Actor and AsApActor impls for ApObject

View file

@ -1,7 +1,7 @@
[package] [package]
name = "activitystreams" name = "activitystreams"
description = "A set of core types and traits for activitystreams data" description = "A set of core types and traits for activitystreams data"
version = "0.7.0-alpha.6" version = "0.7.0-alpha.7"
license = "GPL-3.0" license = "GPL-3.0"
authors = ["asonix <asonix@asonix.dog>"] authors = ["asonix <asonix@asonix.dog>"]
repository = "https://git.asonix.dog/Aardwolf/activitystreams" repository = "https://git.asonix.dog/Aardwolf/activitystreams"

View file

@ -1850,6 +1850,18 @@ impl<Kind> AsBase<Kind> for Base<Kind> {
} }
} }
impl<Kind> Extends<Kind> for Base<Kind> {
type Error = std::convert::Infallible;
fn extends(base: Base<Kind>) -> Result<Self, Self::Error> {
Ok(base)
}
fn retracts(self) -> Result<Base<Kind>, Self::Error> {
Ok(self)
}
}
impl<T, Kind> ExtendsExt<Kind> for T impl<T, Kind> ExtendsExt<Kind> for T
where where
T: Extends<Kind>, T: Extends<Kind>,