mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 00:45:18 +03:00
make repo error types require std::error::Error
Summary: This gets us `Display` support as well. Reviewed By: lukaspiatkowski Differential Revision: D5734383 fbshipit-source-id: 1485cf80bb310cdd282b4546bed56c60082be8ec
This commit is contained in:
parent
8202a344b4
commit
c1a30e25c9
@ -31,6 +31,7 @@ extern crate serde;
|
||||
|
||||
extern crate bincode;
|
||||
|
||||
use std::error;
|
||||
use std::io;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::Arc;
|
||||
@ -145,7 +146,7 @@ fn copy_manifest_entry<E>(
|
||||
) -> BoxFuture<(), Error>
|
||||
where
|
||||
Error: From<E>,
|
||||
E: Send + 'static,
|
||||
E: error::Error + Send + 'static,
|
||||
{
|
||||
let hash = *entry.get_hash();
|
||||
|
||||
|
@ -38,6 +38,7 @@ extern crate serde;
|
||||
extern crate serde_json;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::error;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::str::FromStr;
|
||||
use std::string::ToString;
|
||||
@ -140,7 +141,7 @@ struct TreeMetadata {
|
||||
impl TreeMetadata {
|
||||
fn new<E>(size: Option<usize>, entry: Box<mercurial_types::Entry<Error = E>>) -> TreeMetadata
|
||||
where
|
||||
E: Send + 'static,
|
||||
E: error::Error + Send + 'static,
|
||||
{
|
||||
TreeMetadata {
|
||||
hash: entry.get_hash().clone(),
|
||||
|
@ -4,6 +4,7 @@
|
||||
// This software may be used and distributed according to the terms of the
|
||||
// GNU General Public License version 2 or any later version.
|
||||
|
||||
use std::error;
|
||||
use std::fmt::{self, Display};
|
||||
use std::marker::PhantomData;
|
||||
|
||||
@ -17,7 +18,7 @@ use path::Path;
|
||||
|
||||
/// Interface for a manifest
|
||||
pub trait Manifest: Send + 'static {
|
||||
type Error: Send + 'static;
|
||||
type Error: error::Error + Send + 'static;
|
||||
|
||||
fn lookup(
|
||||
&self,
|
||||
@ -52,7 +53,7 @@ where
|
||||
impl<M, E> BoxManifest<M, E>
|
||||
where
|
||||
M: Manifest + Sync + Send + 'static,
|
||||
E: Send + 'static,
|
||||
E: error::Error + Send + 'static,
|
||||
{
|
||||
pub fn new(manifest: M) -> Box<Manifest<Error = E> + Sync>
|
||||
where
|
||||
@ -78,7 +79,7 @@ where
|
||||
impl<M, E> Manifest for BoxManifest<M, E>
|
||||
where
|
||||
M: Manifest + Sync + Send + 'static,
|
||||
E: Send + 'static,
|
||||
E: error::Error + Send + 'static,
|
||||
{
|
||||
type Error = E;
|
||||
|
||||
@ -106,7 +107,10 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: Send + 'static> Manifest for Box<Manifest<Error = E> + Sync> {
|
||||
impl<E> Manifest for Box<Manifest<Error = E> + Sync>
|
||||
where
|
||||
E: error::Error + Send + 'static,
|
||||
{
|
||||
type Error = E;
|
||||
|
||||
fn lookup(
|
||||
@ -138,11 +142,11 @@ pub enum Content<E> {
|
||||
|
||||
impl<E> Content<E>
|
||||
where
|
||||
E: Send + 'static,
|
||||
E: error::Error + Send + 'static,
|
||||
{
|
||||
fn map_err<ME>(self, cvterr: fn(E) -> ME) -> Content<ME>
|
||||
where
|
||||
ME: Send + 'static,
|
||||
ME: error::Error + Send + 'static,
|
||||
{
|
||||
match self {
|
||||
Content::Tree(m) => Content::Tree(BoxManifest::new_with_cvterr(m, cvterr)),
|
||||
@ -154,7 +158,7 @@ where
|
||||
}
|
||||
|
||||
pub trait Entry: Send + 'static {
|
||||
type Error: Send + 'static;
|
||||
type Error: error::Error + Send + 'static;
|
||||
|
||||
fn get_type(&self) -> Type;
|
||||
fn get_parents(&self) -> BoxFuture<Parents, Self::Error>;
|
||||
@ -191,7 +195,7 @@ where
|
||||
impl<Ent, E> BoxEntry<Ent, E>
|
||||
where
|
||||
Ent: Entry + Sync + Send + 'static,
|
||||
E: Send + 'static,
|
||||
E: error::Error + Send + 'static,
|
||||
{
|
||||
pub fn new(entry: Ent) -> Box<Entry<Error = E> + Sync>
|
||||
where
|
||||
@ -215,7 +219,7 @@ where
|
||||
impl<Ent, E> Entry for BoxEntry<Ent, E>
|
||||
where
|
||||
Ent: Entry + Sync + Send + 'static,
|
||||
E: Send + 'static,
|
||||
E: error::Error + Send + 'static,
|
||||
{
|
||||
type Error = E;
|
||||
|
||||
@ -253,7 +257,10 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<E: Send + 'static> Entry for Box<Entry<Error = E> + Sync> {
|
||||
impl<E> Entry for Box<Entry<Error = E> + Sync>
|
||||
where
|
||||
E: error::Error + Send + 'static,
|
||||
{
|
||||
type Error = E;
|
||||
|
||||
fn get_type(&self) -> Type {
|
||||
|
@ -4,6 +4,8 @@
|
||||
// This software may be used and distributed according to the terms of the
|
||||
// GNU General Public License version 2 or any later version.
|
||||
|
||||
use std::error;
|
||||
|
||||
use futures::{Future, Stream};
|
||||
|
||||
/// A general source control Node
|
||||
@ -17,7 +19,7 @@ use futures::{Future, Stream};
|
||||
/// code.
|
||||
pub trait Node: Sized {
|
||||
type Content;
|
||||
type Error;
|
||||
type Error: error::Error;
|
||||
|
||||
type GetParents: Stream<Item = Self, Error = Self::Error>;
|
||||
type GetContent: Future<Item = Self::Content, Error = Self::Error>;
|
||||
|
@ -4,6 +4,7 @@
|
||||
// This software may be used and distributed according to the terms of the
|
||||
// GNU General Public License version 2 or any later version.
|
||||
|
||||
use std::error;
|
||||
use std::marker::PhantomData;
|
||||
use std::sync::Arc;
|
||||
|
||||
@ -25,7 +26,7 @@ pub type BoxedBookmarks<E> = Box<
|
||||
>;
|
||||
|
||||
pub trait Repo: 'static {
|
||||
type Error: Send + 'static;
|
||||
type Error: error::Error + Send + 'static;
|
||||
|
||||
/// Return a stream of all changeset ids
|
||||
///
|
||||
@ -73,7 +74,7 @@ where
|
||||
impl<R, E> BoxRepo<R, E>
|
||||
where
|
||||
R: Repo + Sync + Send,
|
||||
E: Send + 'static,
|
||||
E: error::Error + Send + 'static,
|
||||
{
|
||||
pub fn new(repo: R) -> Box<Repo<Error = E> + Sync + Send>
|
||||
where
|
||||
@ -99,7 +100,7 @@ where
|
||||
impl<R, E> Repo for BoxRepo<R, E>
|
||||
where
|
||||
R: Repo + Sync + Send + 'static,
|
||||
E: Send + 'static,
|
||||
E: error::Error + Send + 'static,
|
||||
{
|
||||
type Error = E;
|
||||
|
||||
@ -149,7 +150,7 @@ where
|
||||
|
||||
impl<RE> Repo for Box<Repo<Error = RE>>
|
||||
where
|
||||
RE: Send + 'static,
|
||||
RE: error::Error + Send + 'static,
|
||||
{
|
||||
type Error = RE;
|
||||
|
||||
@ -183,7 +184,7 @@ where
|
||||
|
||||
impl<RE> Repo for Arc<Repo<Error = RE>>
|
||||
where
|
||||
RE: Send + 'static,
|
||||
RE: error::Error + Send + 'static,
|
||||
{
|
||||
type Error = RE;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user