MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / asyncWrite

Method asyncWrite

Libraries/AsyncStreams/AsyncStreams.cpp:913–936  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

911AsyncTransformStream::AsyncTransformStream() {}
912
913Result AsyncTransformStream::asyncWrite(AsyncBufferView::ID bufferID, Function<void(AsyncBufferView::ID)> cb)
914{
915 switch (state)
916 {
917 case State::None: {
918 SC_TRY(AsyncReadableStream::getBuffersPool().getReadableData(bufferID, inputData));
919 return prepare(bufferID, cb);
920 }
921 case State::Paused: {
922 SC_TRY_MSG(bufferID == inputBufferID, "Logical Error")
923 return prepare(bufferID, cb);
924 }
925 case State::Finalized: {
926 return Result::Error("Transform cannot be called during Finalized State");
927 }
928 case State::Processing: {
929 return Result::Error("Transform cannot be called during Processing State");
930 }
931 case State::Finalizing: {
932 return Result::Error("Transform cannot be called during Finalizing State");
933 }
934 }
935 return Result(true);
936}
937
938Result AsyncTransformStream::prepare(AsyncBufferView::ID bufferID, Function<void(AsyncBufferView::ID)> cb)
939{

Callers

nothing calls this directly

Calls 8

stopFunction · 0.85
getReadableDataMethod · 0.80
sliceStartMethod · 0.80
unrefBufferMethod · 0.80
ErrorEnum · 0.50
ResultClass · 0.50
sizeInBytesMethod · 0.45
processMethod · 0.45

Tested by

no test coverage detected