loosen InlineableFactory for NullableFactory
				
					
				
			This commit is contained in:
		
							parent
							
								
									510f22efd2
								
							
						
					
					
						commit
						aed81eac83
					
				@ -87,7 +87,7 @@ where
 | 
			
		||||
/// [`Factory`] associated with the [`Mentionable`]. Mostly useful for `type` definitions.
 | 
			
		||||
pub type Fctr<'a, Ctx, A> = <A as MentionableBase<'a, Ctx>>::Fctr;
 | 
			
		||||
 | 
			
		||||
/// Shorthand for the type of values returned by [`ParseFactory::deserialize`].
 | 
			
		||||
/// Shorthand for the type of values returned by [`FactoryParse::deserialize`].
 | 
			
		||||
pub type ParseResult<'a, Ctx, F> = Result<Mtbl<'a, Ctx, F>, ParseError<'a, Ctx, F>>;
 | 
			
		||||
 | 
			
		||||
/// [`ParseResult`] associated with a [`Mentionable`] (instead of a [`Factory`]).
 | 
			
		||||
@ -97,7 +97,7 @@ pub type ParseResultA<'a, Ctx, A> = Result<A, ParseErrorA<'a, Ctx, A>>;
 | 
			
		||||
pub trait FactoryBase<'a, Ctx: Context<'a>>: 'a + Send + Sync + Clone {
 | 
			
		||||
    /// Type of the associated objects.
 | 
			
		||||
    type Mtbl: MentionableBase<'a, Ctx, Fctr = Self>;
 | 
			
		||||
    /// Type of an error that [`ParseFactory::deserialize`] can fail with.
 | 
			
		||||
    /// Type of an error that [`FactoryParse::deserialize`] can fail with.
 | 
			
		||||
    type ParseError: 'a + Error;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -5,7 +5,7 @@ use super::*;
 | 
			
		||||
pub enum ResolutionError<L, P> {
 | 
			
		||||
    /// Usually comes from [`Resolver::resolve`].
 | 
			
		||||
    Lookup(L),
 | 
			
		||||
    /// Usually comes from [`ParseFactory::deserialize`].
 | 
			
		||||
    /// Usually comes from [`FactoryParse::deserialize`].
 | 
			
		||||
    Parse(P),
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -30,7 +30,7 @@ impl Serializer for Vec<u8> {
 | 
			
		||||
 | 
			
		||||
/// Trait representing a readable stream used for parsing.
 | 
			
		||||
///
 | 
			
		||||
/// See [`Serializer`], [`ParseFactory::deserialize`].
 | 
			
		||||
/// See [`Serializer`], [`FactoryParse::deserialize`].
 | 
			
		||||
pub trait Deserializer {
 | 
			
		||||
    /// Read at most `n` bytes.
 | 
			
		||||
    fn read_n(&mut self, n: usize) -> &[u8];
 | 
			
		||||
 | 
			
		||||
@ -29,9 +29,9 @@ pub trait AtomicBase: 'static + Send + Sync + Send + Clone + Serializable {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
pub trait Atomic: AtomicBase + ParseMode {
 | 
			
		||||
    /// Static equivalent of [`ParseFactory::deserialize`].
 | 
			
		||||
    /// Static equivalent of [`FactoryParse::deserialize`].
 | 
			
		||||
    fn a_deserialize(inlining: impl Inlining) -> AParseResult<Self>;
 | 
			
		||||
    /// Static equivalent of [`ParseFactory::extend`].
 | 
			
		||||
    /// Static equivalent of [`FactoryParse::extend`].
 | 
			
		||||
    fn a_extend(self, tail: &[u8]) -> AParseResult<Self>;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -107,7 +107,9 @@ impl<'a, Ctx: Context<'a>, A: MentionableBase<'a, Ctx>> Clone for Nullable<'a, C
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl<'a, Ctx: Context<'a>, F: Factory<'a, Ctx>> InlineableFactory<'a, Ctx> for NullableFactory<F> {
 | 
			
		||||
impl<'a, Ctx: Context<'a>, F: FactoryBase<'a, Ctx>> InlineableFactory<'a, Ctx>
 | 
			
		||||
    for NullableFactory<F>
 | 
			
		||||
{
 | 
			
		||||
    fn extension_error(&self, tail: &[u8]) -> Self::ParseError {
 | 
			
		||||
        PointParseError::WrongLength(HASH_SIZE + tail.len())
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user