MailboxProcessor.TryScan<'Msg,'T> Method (F#)
Scans for a message by looking through messages in arrival order until a provided function returns a Some value. Other messages remain in the queue.
Namespace/Module Path: Microsoft.FSharp.Control
Assembly: FSharp.Core (in FSharp.Core.dll)
// Signature: member this.TryScan : ('Msg -> Async<'T> option) * ?int -> Async<'T option> // Usage: mailboxProcessor.TryScan (scanner) mailboxProcessor.TryScan (scanner, timeout = timeout)
Returns None if a timeout is given and the timeout is exceeded. This method is for use within the body of the agent. For each agent, at most one concurrent reader can be active, so no more than one concurrent call to Receive, TryReceive, Scan or TryScan can be active. The body of the scanner function is locked during its execution, but the lock is released before the execution of the asynchronous workflow.