浏览代码

remove streamTransformer generic type inherit type

/main
Xingwei Zhu 3 年前
当前提交
febee735
共有 4 个文件被更改,包括 60 次插入15 次删除
  1. 4
      com.unity.uiwidgets/Runtime/async/async_cast.cs
  2. 12
      com.unity.uiwidgets/Runtime/async/stream.cs
  3. 45
      com.unity.uiwidgets/Runtime/async/stream_controller.cs
  4. 14
      com.unity.uiwidgets/Runtime/async/stream_transformers.cs

4
com.unity.uiwidgets/Runtime/async/async_cast.cs


return result;
}
Stream<R> cast<R>() where R : class => new CastStream<S, R>(_source);
Stream<R> cast<R>() => new CastStream<S, R>(_source);
}

}
class CastStreamTransformer<SS, ST, TS, TT>
: StreamTransformerBase<TS, TT> where TT : class where ST : class {
: StreamTransformerBase<TS, TT> {
public readonly StreamTransformer<SS, ST> _source;
public CastStreamTransformer(StreamTransformer<SS, ST> _source) {

12
com.unity.uiwidgets/Runtime/async/stream.cs


return streamConsumer.addStream(this).then((_) => streamConsumer.close(), (_) => FutureOr.nil);
}
public Stream<S> transform<S>(StreamTransformer<T, S> streamTransformer) where S : class {
public Stream<S> transform<S>(StreamTransformer<T, S> streamTransformer) {
return streamTransformer.bind(this);
}

// }
}
public abstract class StreamTransformer<S, T> where T : class {
public abstract class StreamTransformer<S, T> {
where T : class {
{
return new _StreamSubscriptionTransformer<S, T>(onListen);
}

}
public static StreamTransformer<TS, TT> castFrom<SS, ST, TS, TT>(
StreamTransformer<SS, ST> source) where TT : class where ST : class {
StreamTransformer<SS, ST> source) {
public abstract StreamTransformer<RS, RT> cast<RS, RT>() where RT : class;
public abstract StreamTransformer<RS, RT> cast<RS, RT>();
public abstract class StreamTransformerBase<S, T> : StreamTransformer<S, T> where T : class {
public abstract class StreamTransformerBase<S, T> : StreamTransformer<S, T> {
public StreamTransformerBase() {
}

45
com.unity.uiwidgets/Runtime/async/stream_controller.cs


}
}
public abstract class StreamController<T> : StreamSink<T> {
public interface IStreamController<T> {
Stream<T> stream { get; }
_stream.ControllerCallback onListen { get; set; }
// void onListen(void onListenHandler());
_stream.ControllerCallback onPause { get; set; }
// void set onPause(void onPauseHandler());
_stream.ControllerCallback onResume { get; set; }
// void set onResume(void onResumeHandler());
_stream.ControllerCancelCallback onCancel { get; set; }
// void set onCancel(onCancelHandler());
StreamSink<T> sink { get; }
bool isClosed { get; }
bool isPaused { get; }
/** Whether there is a subscriber on the [Stream]. */
bool hasListener { get; }
// public abstract void add(T evt);
//
// public abstract void addError(object error, string stackTrace);
Future close();
Future addStream(Stream<T> source, bool? cancelOnError = false);
void add(T evt);
void addError(object error, string stackTrace);
Future done { get; }
}
public abstract class StreamController<T> : StreamSink<T>, IStreamController<T> {
/** The stream that this controller is controlling. */
public virtual Stream<T> stream { get; }

14
com.unity.uiwidgets/Runtime/async/stream_transformers.cs


using System;
using Unity.UIWidgets.async;
using UnityEngine;
namespace Unity.UIWidgets.async {
class _EventSinkWrapper<T> : EventSink<T> {

}
}
class _StreamSinkTransformer<S, T> : StreamTransformerBase<S, T> where T : class {
class _StreamSinkTransformer<S, T> : StreamTransformerBase<S, T> {
readonly _async._SinkMapper<S, T> _sinkMapper;
public _StreamSinkTransformer(_async._SinkMapper<S, T> _sinkMapper) {

public delegate void _TransformDoneHandler<T>(EventSink<T> sink);
}
class _HandlerEventSink<S, T> : EventSink<S> where T : class {
class _HandlerEventSink<S, T> : EventSink<S> {
readonly _stream._TransformDataHandler<S, T> _handleData;
readonly _stream._TransformErrorHandler<T> _handleError;
readonly _stream._TransformDoneHandler<T> _handleDone;

_handleData(data, _sink);
}
else {
_sink.add(data as T);
Debug.Log("potential bad type casting !!!!");
_sink.add((T)((object)data));
}
}

}
}
class _StreamHandlerTransformer<S, T> : _StreamSinkTransformer<S, T> where T : class {
class _StreamHandlerTransformer<S, T> : _StreamSinkTransformer<S, T> {
internal _StreamHandlerTransformer(
_stream._TransformDataHandler<S, T> handleData = null,
_stream._TransformErrorHandler<T> handleError = null,

}
}
class _StreamBindTransformer<S, T> : StreamTransformerBase<S, T> where T : class {
class _StreamBindTransformer<S, T> : StreamTransformerBase<S, T> {
readonly Func<Stream<S>, Stream<T>> _bind;
internal _StreamBindTransformer(Func<Stream<S>, Stream<T>> _bind) {

public delegate StreamSubscription<T> _SubscriptionTransformer<S, T>(Stream<S> stream, bool cancelOnError);
}
class _StreamSubscriptionTransformer<S, T> : StreamTransformerBase<S, T> where T : class {
class _StreamSubscriptionTransformer<S, T> : StreamTransformerBase<S, T> {
readonly _async._SubscriptionTransformer<S, T> _onListen;
internal _StreamSubscriptionTransformer(_async._SubscriptionTransformer<S, T> _onListen) {

正在加载...
取消
保存