##// END OF EJS Templates
preview version of Unity xml configuration
preview version of Unity xml configuration

File last commit:

r259:7d52dc684bbd v3
r272:9d1cca834b05 v3
Show More
PromiseExtensions.cs
226 lines | 10.0 KiB | text/x-csharp | CSharpLexer
/ Implab / PromiseExtensions.cs
cin
promises refactoring
r72 using System.Threading;
cin
major refactoring, added tasks support
r75 using System;
cin
minor fixes
r109 using Implab.Diagnostics;
cin
Promises rewritten, added improved version of AsyncQueue
r119 using System.Collections.Generic;
cin
Added awaiters to promises...
r248 using System.Linq;
cin
promises refactoring
r72 namespace Implab {
public static class PromiseExtensions {
cin
Added awaiters to promises...
r248 public static IPromise Then(this IPromise that, Action fulfilled, Action<Exception> rejected) {
cin
Implab.Test moved to xunit...
r249 var reaction = PromiseActionReaction.Create(fulfilled, rejected, Promise.DefaultDispatcher);
that.Then(reaction);
return reaction.Promise;
}
public static IPromise Then(this IPromise that, Action fulfilled) {
var reaction = PromiseActionReaction.Create(fulfilled, null, Promise.DefaultDispatcher);
cin
Added awaiters to promises...
r248 that.Then(reaction);
return reaction.Promise;
cin
code cleanup...
r101 }
cin
Added awaiters to promises...
r248 public static IPromise Then(this IPromise that, Action fulfilled, Func<Exception, IPromise> rejected) {
cin
Implab.Test moved to xunit...
r249 var reaction = PromiseActionReaction.Create(fulfilled, rejected, Promise.DefaultDispatcher);
cin
Added awaiters to promises...
r248 that.Then(reaction);
return reaction.Promise;
cin
added Safe.DispatchEvent() a legacy equivalent for '?.Invoke()'...
r207 }
cin
Added awaiters to promises...
r248 public static IPromise Then(this IPromise that, Func<IPromise> fulfilled, Action<Exception> rejected) {
cin
Implab.Test moved to xunit...
r249 var reaction = PromiseActionReaction.Create(fulfilled, rejected, Promise.DefaultDispatcher);
that.Then(reaction);
return reaction.Promise;
}
public static IPromise Then(this IPromise that, Func<IPromise> fulfilled) {
var reaction = PromiseActionReaction.Create(fulfilled, null, Promise.DefaultDispatcher);
cin
Added awaiters to promises...
r248 that.Then(reaction);
return reaction.Promise;
cin
major refactoring, added tasks support
r75 }
cin
added promise timeout helper
r110
cin
Added awaiters to promises...
r248 public static IPromise Then(this IPromise that, Func<IPromise> fulfilled, Func<Exception, IPromise> rejected) {
cin
Implab.Test moved to xunit...
r249 var reaction = PromiseActionReaction.Create(fulfilled, rejected, Promise.DefaultDispatcher);
cin
Added awaiters to promises...
r248 that.Then(reaction);
return reaction.Promise;
cin
added promise timeout helper
r110 }
cin
Promises rewritten, added improved version of AsyncQueue
r119
cin
Added awaiters to promises...
r248 public static IPromise Then<T>(this IPromise<T> that, Action<T> fulfilled, Action<Exception> rejected) {
cin
Implab.Test moved to xunit...
r249 var reaction = PromiseActionReaction<T>.Create(fulfilled, rejected, Promise.DefaultDispatcher);
that.Then(reaction);
return reaction.Promise;
}
public static IPromise Then<T>(this IPromise<T> that, Action<T> fulfilled) {
var reaction = PromiseActionReaction<T>.Create(fulfilled, null, Promise.DefaultDispatcher);
cin
Added awaiters to promises...
r248 that.Then(reaction);
return reaction.Promise;
cin
Added ResetState to RunnableComponent to reset in case of failure...
r205 }
cin
Added awaiters to promises...
r248 public static IPromise Then<T>(this IPromise<T> that, Action<T> fulfilled, Func<Exception, IPromise> rejected) {
cin
Implab.Test moved to xunit...
r249 var reaction = PromiseActionReaction<T>.Create(fulfilled, rejected, Promise.DefaultDispatcher);
cin
Added awaiters to promises...
r248 that.Then(reaction);
return reaction.Promise;
cin
RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)...
r208 }
cin
Added awaiters to promises...
r248 public static IPromise Then<T>(this IPromise<T> that, Func<T, IPromise> fulfilled, Action<Exception> rejected) {
cin
Implab.Test moved to xunit...
r249 var reaction = PromiseActionReaction<T>.Create(fulfilled, rejected, Promise.DefaultDispatcher);
that.Then(reaction);
return reaction.Promise;
}
public static IPromise Then<T>(this IPromise<T> that, Func<T, IPromise> fulfilled) {
var reaction = PromiseActionReaction<T>.Create(fulfilled, null, Promise.DefaultDispatcher);
cin
Added awaiters to promises...
r248 that.Then(reaction);
return reaction.Promise;
cin
major update, added Drain mathod to AsyncQueue class
r124 }
cin
RC: cancellation support for promises + tests
r145
cin
Added awaiters to promises...
r248 public static IPromise Then<T>(this IPromise<T> that, Func<T, IPromise> fulfilled, Func<Exception, IPromise> rejected) {
cin
Implab.Test moved to xunit...
r249 var reaction = PromiseActionReaction<T>.Create(fulfilled, rejected, Promise.DefaultDispatcher);
cin
Added awaiters to promises...
r248 that.Then(reaction);
return reaction.Promise;
}
cin
RC: cancellation support for promises + tests
r145
cin
Added awaiters to promises...
r248 public static IPromise<Tout> Then<Tout>(this IPromise that, Func<Tout> fulfilled, Func<Exception, Tout> rejected) {
cin
Implab.Test moved to xunit...
r249 var reaction = PromiseFuncReaction<Tout>.Create(fulfilled, rejected, Promise.DefaultDispatcher);
that.Then(reaction);
return reaction.Promise;
}
public static IPromise<Tout> Then<Tout>(this IPromise that, Func<Tout> fulfilled) {
var reaction = PromiseFuncReaction<Tout>.Create(fulfilled, (Func<Exception, Tout>)null, Promise.DefaultDispatcher);
cin
Added awaiters to promises...
r248 that.Then(reaction);
return reaction.Promise;
cin
RC: cancellation support for promises + tests
r145 }
cin
Added awaiters to promises...
r248 public static IPromise<Tout> Then<Tout>(this IPromise that, Func<Tout> fulfilled, Func<Exception, IPromise<Tout>> rejected) {
cin
Implab.Test moved to xunit...
r249 var reaction = PromiseFuncReaction<Tout>.Create(fulfilled, rejected, Promise.DefaultDispatcher);
cin
Added awaiters to promises...
r248 that.Then(reaction);
return reaction.Promise;
cin
RC: cancellation support for promises + tests
r145 }
cin
Added awaiters to promises...
r248 public static IPromise<Tout> Then<Tout>(this IPromise that, Func<IPromise<Tout>> fulfilled, Func<Exception, Tout> rejected) {
cin
Implab.Test moved to xunit...
r249 var reaction = PromiseFuncReaction<Tout>.Create(fulfilled, rejected, Promise.DefaultDispatcher);
that.Then(reaction);
return reaction.Promise;
}
public static IPromise<Tout> Then<Tout>(this IPromise that, Func<IPromise<Tout>> fulfilled) {
var reaction = PromiseFuncReaction<Tout>.Create(fulfilled, (Func<Exception, Tout>)null, Promise.DefaultDispatcher);
cin
Added awaiters to promises...
r248 that.Then(reaction);
return reaction.Promise;
cin
added Safe.DispatchEvent() a legacy equivalent for '?.Invoke()'...
r207 }
cin
Added awaiters to promises...
r248 public static IPromise<Tout> Then<Tout>(this IPromise that, Func<IPromise<Tout>> fulfilled, Func<Exception, IPromise<Tout>> rejected) {
cin
Implab.Test moved to xunit...
r249 var reaction = PromiseFuncReaction<Tout>.Create(fulfilled, rejected, Promise.DefaultDispatcher);
cin
Added awaiters to promises...
r248 that.Then(reaction);
return reaction.Promise;
cin
RC: cancellation support for promises + tests
r145 }
cin
Added awaiters to promises...
r248 public static IPromise<Tout> Then<Tin, Tout>(this IPromise<Tin> that, Func<Tin, Tout> fulfilled, Func<Exception, Tout> rejected) {
cin
Implab.Test moved to xunit...
r249 var reaction = PromiseFuncReaction<Tin, Tout>.Create(fulfilled, rejected, Promise.DefaultDispatcher);
that.Then(reaction);
return reaction.Promise;
}
public static IPromise<Tout> Then<Tin, Tout>(this IPromise<Tin> that, Func<Tin, Tout> fulfilled) {
var reaction = PromiseFuncReaction<Tin, Tout>.Create(fulfilled, (Func<Exception, Tout>)null, Promise.DefaultDispatcher);
cin
Added awaiters to promises...
r248 that.Then(reaction);
return reaction.Promise;
cin
added Safe.DispatchEvent() a legacy equivalent for '?.Invoke()'...
r207 }
cin
Added awaiters to promises...
r248 public static IPromise<Tout> Then<Tin, Tout>(this IPromise<Tin> that, Func<Tin, Tout> fulfilled, Func<Exception, IPromise<Tout>> rejected) {
cin
Implab.Test moved to xunit...
r249 var reaction = PromiseFuncReaction<Tin, Tout>.Create(fulfilled, rejected, Promise.DefaultDispatcher);
cin
Added awaiters to promises...
r248 that.Then(reaction);
return reaction.Promise;
cin
added Safe.DispatchEvent() a legacy equivalent for '?.Invoke()'...
r207 }
cin
Added awaiters to promises...
r248 public static IPromise<Tout> Then<Tin, Tout>(this IPromise<Tin> that, Func<Tin, IPromise<Tout>> fulfilled, Func<Exception, Tout> rejected) {
cin
Implab.Test moved to xunit...
r249 var reaction = PromiseFuncReaction<Tin, Tout>.Create(fulfilled, rejected, Promise.DefaultDispatcher);
that.Then(reaction);
return reaction.Promise;
}
public static IPromise<Tout> Then<Tin, Tout>(this IPromise<Tin> that, Func<Tin, IPromise<Tout>> fulfilled) {
var reaction = PromiseFuncReaction<Tin, Tout>.Create(fulfilled, (Func<Exception, Tout>)null, Promise.DefaultDispatcher);
cin
Added awaiters to promises...
r248 that.Then(reaction);
return reaction.Promise;
cin
added Safe.DispatchEvent() a legacy equivalent for '?.Invoke()'...
r207 }
cin
Added awaiters to promises...
r248 public static IPromise<Tout> Then<Tin, Tout>(this IPromise<Tin> that, Func<Tin, IPromise<Tout>> fulfilled, Func<Exception, IPromise<Tout>> rejected) {
cin
Implab.Test moved to xunit...
r249 var reaction = PromiseFuncReaction<Tin, Tout>.Create(fulfilled, rejected, Promise.DefaultDispatcher);
cin
Added awaiters to promises...
r248 that.Then(reaction);
return reaction.Promise;
cin
RC: cancellation support for promises + tests
r145 }
cin
Added awaiters to promises...
r248 public static IPromise Catch(this IPromise that, Action<Exception> rejected) {
return Then(that, null, rejected);
cin
RC: cancellation support for promises + tests
r145 }
cin
Added awaiters to promises...
r248 public static IPromise Catch(this IPromise that, Func<Exception, IPromise> rejected) {
return Then(that, null, rejected);
cin
RC: cancellation support for promises + tests
r145 }
cin
Added awaiters to promises...
r248 public static IPromise<Tout> Catch<Tout>(this IPromise that, Func<Exception, Tout> rejected) {
return Then(that, (Func<Tout>)null, rejected);
cin
RC: cancellation support for promises + tests
r145 }
cin
Added awaiters to promises...
r248 public static IPromise<Tout> Catch<Tout>(this IPromise that, Func<Exception, IPromise<Tout>> rejected) {
return Then(that, (Func<Tout>)null, rejected);
}
cin
major refactoring, added tasks support
r75
cin
Added awaiters to promises...
r248 public static IPromise<Tout> Catch<Tin, Tout>(this IPromise<Tin> that, Func<Exception, Tout> rejected) {
return Then(that, (Func<Tin, Tout>)null, rejected);
}
cin
RunnableComponent.Dispose(bool,Exception) changed to standart Dispose(bool)...
r208
cin
Added awaiters to promises...
r248 public static IPromise<Tout> Catch<Tin, Tout>(this IPromise<Tin> that, Func<Exception, IPromise<Tout>> rejected) {
return Then(that, (Func<Tin, Tout>)null, rejected);
}
cin
Implab.Test moved to xunit...
r249
public static IPromise Finally(this IPromise that, Action final) {
return Then(that, final, e => {
final();
throw e.Rethrow();
});
}
public static IPromise Finally(this IPromise that, Func<IPromise> final) {
return Then(that, final, e => {
final();
throw e.Rethrow();
});
}
public static IPromise<T> Finally<T>(this IPromise<T> that, Action final) {
return Then<T, T>(that, x => {
final();
return x;
}, new Func<Exception, T>(e => {
final();
throw e.Rethrow();
}));
}
public static IPromise<T> Finally<T>(this IPromise<T> that, Func<IPromise> final) {
return Then<T, T>(that, x => {
return final()
.Then(() => x);
}, new Func<Exception, IPromise<T>>(e => {
return final()
.Then(new Func<T>(() => {
throw e.Rethrow();
}));
}));
}
cin
PollingComponent: implemented correct stopping
r259 public static PromiseAwaiter GetAwaiter(this IPromise that) {
Safe.ArgumentNotNull(that, nameof(that));
return new PromiseAwaiter(that);
}
public static PromiseAwaiter<T> GetAwaiter<T>(this IPromise<T> that) {
Safe.ArgumentNotNull(that, nameof(that));
return new PromiseAwaiter<T>(that);
}
cin
Implab.Test moved to xunit...
r249
cin
promises refactoring
r72 }
}