forked from lavina/lavina
1
0
Fork 0

Compare commits

..

8 Commits

Author SHA1 Message Date
Nikita Vilunov f85c3bb6ce fix 2023-11-06 22:04:10 +01:00
Nikita Vilunov 7cb541f02e finish happy path 2023-11-06 21:50:14 +01:00
Nikita Vilunov bafcd97632 test for server response 2023-11-01 23:12:35 +04:00
Nikita Vilunov fa880af66c wip 2023-11-01 23:04:22 +04:00
Nikita Vilunov fb9303f734 skip tests 2023-10-14 21:21:49 +02:00
Nikita Vilunov f20658559c format 2023-10-14 21:13:49 +02:00
Nikita Vilunov 4929da3f05 move sasl into separate crate 2023-10-14 01:37:06 +02:00
Nikita Vilunov 49f8def1d4 irc: sasl 2023-10-14 01:35:34 +02:00
5 changed files with 10 additions and 11 deletions

1
.gitignore vendored
View File

@ -1,4 +1,3 @@
/target
/db.sqlite
.idea/
.DS_Store

View File

@ -1,4 +1,4 @@
#![feature(coroutines, coroutine_trait, type_alias_impl_trait, impl_trait_in_assoc_type)]
#![feature(generators, generator_trait, type_alias_impl_trait, impl_trait_in_assoc_type)]
mod proto;

View File

@ -1,6 +1,6 @@
#![feature(
coroutines,
coroutine_trait,
generators,
generator_trait,
type_alias_impl_trait,
impl_trait_in_assoc_type
)]

View File

@ -1,4 +1,4 @@
use std::ops::Coroutine;
use std::ops::Generator;
use std::pin::Pin;
use quick_xml::NsReader;
@ -37,7 +37,7 @@ pub trait Parser: Sized {
impl<T, Out> Parser for T
where
T: Coroutine<(ResolveResult<'static>, &'static Event<'static>), Yield = (), Return = Out>
T: Generator<(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 coroutines
// 1. don't support higher-kinded lifetimes (i.e. no `impl for <'a> Coroutine<Event<'a>>)
// 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>>)
// 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::CoroutineState::Yielded(()) => Continuation::Continue(self),
std::ops::CoroutineState::Complete(res) => Continuation::Final(res),
std::ops::GeneratorState::Yielded(()) => Continuation::Continue(self),
std::ops::GeneratorState::Complete(res) => Continuation::Final(res),
}
}
}

View File

@ -1 +1 @@
nightly-2023-12-07
nightly-2023-10-06