You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the Lwt_cstruct API seems incomplete now i try to start using it to write buffers out.
specifically, using this as a standard POSIX app albeit (hopefully) in a mirage compatible way, i want to write a Cstruct.t to a file.
i've used Lwt_unix to get me a file_descr Lwt.t, and i've extracted the file_descr from that so that i can Cstruct.write to it:
lwt fd = Lwt_unix.(openfile filename [O_RDWR; O_CREAT] 0o644) in
let _ = Lwt_cstruct.write fd buf in
fd
...except that i can't do that because i need to return an 'a Lwt.t, not an 'a (in this case, 'a is a file_descr).
but then how do i thread things back up so that i can pass the fd through Cstruct.fold somehow? or, as i suspect, do i need to extend Lwt_cstruct to have a fold method?
The text was updated successfully, but these errors were encountered:
Right... the blocking versions do need a blocking fold too. That API could be abstracted a little more through a functor, but it's probably not worth it.
the
Lwt_cstruct
API seems incomplete now i try to start using it to write buffers out.specifically, using this as a standard POSIX app albeit (hopefully) in a mirage compatible way, i want to write a
Cstruct.t
to a file.i've used
Lwt_unix
to get me afile_descr Lwt.t
, and i've extracted thefile_descr
from that so that i canCstruct.write
to it:...except that i can't do that because i need to return an
'a Lwt.t
, not an'a
(in this case,'a
is afile_descr
).but then how do i thread things back up so that i can pass the
fd
throughCstruct.fold
somehow? or, as i suspect, do i need to extendLwt_cstruct
to have afold
method?The text was updated successfully, but these errors were encountered: