is there a good example of creating a python `data...
# development
h
is there a good example of creating a python
datatype
from scratch in rust code?
a
we usually call the function
create_*
that we get when initializing the scheduler, and provide arguments to that
h
ah, like
construct_directory_digest
?
and it looks like that gets invoked in rust with
externs::unsafe_call
a
yes!
h
related question: how much extra stuff on top of the standard rust futures crate is pants using?
at the moment I'm trying to figure out how to lift a
Value
into a
Future
so my code typechecks
and I don't know if I start looking at the crate docs how much I'll be misled
by whatever custom stuff pants is doing
a
future::ok()
, which may already be available as
ok()
depending upon which file you're in
what do you mean by custom stuff
h
like, if there are any pants-specific macros or what have you that are used pervasively around the crate imports
I don't know the futures API super-well
a
i don't think so
h
ok
a
like there's
future::ok()
and then you just
.map()
,
.and_then()
, and then you have to call
.to_boxed()
at the end to make it a
BoxedFuture
oh
sorry
there is indeed a subcrate
boxed_future
i haven't looked in it at all
a
Magic on top we have: •
BoxFuture<Item, Error>
is just an alias for
Box<Future<Item=Item, Error=Error> + Send
try_future!
is like the
try!
macro (which is the same as the
?
operator), but which returns a
BoxFuture
rather than a
Result
(i.e. if its argument is an error, it early-returns a
BoxFuture<_, Error>
of that error, else it unwraps the
Ok(T)
to a
T
Otherwise we’re pretty standard