forked from lavina/lavina
				
			Compare commits
	
		
			6 Commits
		
	
	
		
			f85c3bb6ce
			...
			ce682a842f
		
	
	| Author | SHA1 | Date | 
|---|---|---|
|  | ce682a842f | |
|  | b7d695519e | |
|  | ed83436501 | |
|  | 550c8b74b2 | |
|  | 85fa607e16 | |
|  | 4dbc68adfe | 
|  | @ -1,3 +1,4 @@ | |||
| /target | ||||
| /db.sqlite | ||||
| .idea/ | ||||
| .DS_Store | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| #![feature(generators, generator_trait, type_alias_impl_trait, impl_trait_in_assoc_type)] | ||||
| #![feature(coroutines, coroutine_trait, type_alias_impl_trait, impl_trait_in_assoc_type)] | ||||
| 
 | ||||
| mod proto; | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| #![feature(
 | ||||
|     generators, | ||||
|     generator_trait, | ||||
|     coroutines, | ||||
|     coroutine_trait, | ||||
|     type_alias_impl_trait, | ||||
|     impl_trait_in_assoc_type | ||||
| )] | ||||
|  |  | |||
|  | @ -1,4 +1,4 @@ | |||
| use std::ops::Generator; | ||||
| use std::ops::Coroutine; | ||||
| use std::pin::Pin; | ||||
| 
 | ||||
| use quick_xml::NsReader; | ||||
|  | @ -37,7 +37,7 @@ pub trait Parser: Sized { | |||
| 
 | ||||
| impl<T, Out> Parser for T | ||||
| where | ||||
|     T: Generator<(ResolveResult<'static>, &'static Event<'static>), Yield = (), Return = Out> | ||||
|     T: Coroutine<(ResolveResult<'static>, &'static Event<'static>), Yield = (), Return = Out> | ||||
|         + Unpin, | ||||
| { | ||||
|     type Output = Out; | ||||
|  | @ -48,13 +48,13 @@ where | |||
|         event: &Event<'a>, | ||||
|     ) -> Continuation<Self, Self::Output> { | ||||
|         let s = Pin::new(&mut self); | ||||
|         // this is a very rude workaround fixing the fact that rust generators
 | ||||
|         // 1. don't support higher-kinded lifetimes (i.e. no `impl for <'a> Generator<Event<'a>>)
 | ||||
|         // this is a very rude workaround fixing the fact that rust coroutines
 | ||||
|         // 1. don't support higher-kinded lifetimes (i.e. no `impl for <'a> Coroutine<Event<'a>>)
 | ||||
|         // 2. don't track borrows across yield points and lack thereof
 | ||||
|         // implementors of Parser should manually check that inputs are not used across yields
 | ||||
|         match s.resume(unsafe { std::mem::transmute((namespace, event)) }) { | ||||
|             std::ops::GeneratorState::Yielded(()) => Continuation::Continue(self), | ||||
|             std::ops::GeneratorState::Complete(res) => Continuation::Final(res), | ||||
|             std::ops::CoroutineState::Yielded(()) => Continuation::Continue(self), | ||||
|             std::ops::CoroutineState::Complete(res) => Continuation::Final(res), | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -1 +1 @@ | |||
| nightly-2023-10-06 | ||||
| nightly-2023-12-07 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue