Lines Matching defs:T
98 fn create_file<'a, T, E: 'a>(
101 data: impl PinInit<T, E> + 'a,
102 file_ops: &'static FileOps<T>,
103 ) -> impl PinInit<File<T>, E> + 'a
105 T: Sync + 'static,
107 let scope = Scope::<T>::new(data, move |data| {
165 pub fn read_only_file<'a, T, E: 'a>(
168 data: impl PinInit<T, E> + 'a,
169 ) -> impl PinInit<File<T>, E> + 'a
171 T: Writer + Send + Sync + 'static,
173 let file_ops = &<T as ReadFile<_>>::FILE_OPS;
191 pub fn read_binary_file<'a, T, E: 'a>(
194 data: impl PinInit<T, E> + 'a,
195 ) -> impl PinInit<File<T>, E> + 'a
197 T: BinaryWriter + Send + Sync + 'static,
199 self.create_file(name, data, &T::FILE_OPS)
232 pub fn read_callback_file<'a, T, E: 'a, F>(
235 data: impl PinInit<T, E> + 'a,
237 ) -> impl PinInit<File<T>, E> + 'a
239 T: Send + Sync + 'static,
240 F: Fn(&T, &mut fmt::Formatter<'_>) -> fmt::Result + Send + Sync,
242 let file_ops = <FormatAdapter<T, F>>::FILE_OPS.adapt();
250 pub fn read_write_file<'a, T, E: 'a>(
253 data: impl PinInit<T, E> + 'a,
254 ) -> impl PinInit<File<T>, E> + 'a
256 T: Writer + Reader + Send + Sync + 'static,
258 let file_ops = &<T as ReadWriteFile<_>>::FILE_OPS;
266 pub fn read_write_binary_file<'a, T, E: 'a>(
269 data: impl PinInit<T, E> + 'a,
270 ) -> impl PinInit<File<T>, E> + 'a
272 T: BinaryWriter + BinaryReader + Send + Sync + 'static,
274 let file_ops = &<T as BinaryReadWriteFile<_>>::FILE_OPS;
284 pub fn read_write_callback_file<'a, T, E: 'a, F, W>(
287 data: impl PinInit<T, E> + 'a,
290 ) -> impl PinInit<File<T>, E> + 'a
292 T: Send + Sync + 'static,
293 F: Fn(&T, &mut fmt::Formatter<'_>) -> fmt::Result + Send + Sync,
294 W: Fn(&T, &mut UserSliceReader) -> Result + Send + Sync,
297 <WritableAdapter<FormatAdapter<T, F>, W> as file_ops::ReadWriteFile<_>>::FILE_OPS
309 pub fn write_only_file<'a, T, E: 'a>(
312 data: impl PinInit<T, E> + 'a,
313 ) -> impl PinInit<File<T>, E> + 'a
315 T: Reader + Send + Sync + 'static,
317 self.create_file(name, data, &T::FILE_OPS)
326 pub fn write_binary_file<'a, T, E: 'a>(
329 data: impl PinInit<T, E> + 'a,
330 ) -> impl PinInit<File<T>, E> + 'a
332 T: BinaryReader + Send + Sync + 'static,
334 self.create_file(name, data, &T::FILE_OPS)
341 pub fn write_callback_file<'a, T, E: 'a, W>(
344 data: impl PinInit<T, E> + 'a,
346 ) -> impl PinInit<File<T>, E> + 'a
348 T: Send + Sync + 'static,
349 W: Fn(&T, &mut UserSliceReader) -> Result + Send + Sync,
351 let file_ops = <WritableAdapter<NoWriter<T>, W> as WriteFile<_>>::FILE_OPS
378 /// Creates a new scope, which is a directory associated with some data `T`.
386 pub fn scope<'a, T: 'a, E: 'a, F>(
388 data: impl PinInit<T, E> + 'a,
391 ) -> impl PinInit<Scope<T>, E> + 'a
393 F: for<'data, 'dir> FnOnce(&'data T, &'dir ScopedDir<'data, 'dir>) + 'a,
413 pub struct Scope<T> {
418 data: T,
419 // Even if `T` is `Unpin`, we still can't allow it to be moved.
428 pub struct File<T> {
430 scope: Scope<T>,
434 impl<'b, T: 'b> Scope<T> {
435 fn new<E: 'b, F>(data: impl PinInit<T, E> + 'b, init: F) -> impl PinInit<Self, E> + 'b
437 F: for<'a> FnOnce(&'a T) + 'b,
453 impl<'b, T: 'b> Scope<T> {
459 fn new<E: 'b, F>(data: impl PinInit<T, E> + 'b, init: F) -> impl PinInit<Self, E> + 'b
461 F: for<'a> FnOnce(&'a T) -> Entry<'static> + 'b,
477 impl<'a, T: 'a> Scope<T> {
479 /// associated with some data `T`.
487 data: impl PinInit<T, E> + 'a,
492 F: for<'data, 'dir> FnOnce(&'data T, &'dir ScopedDir<'data, 'dir>) + 'a,
502 impl<T> Deref for Scope<T> {
503 type Target = T;
504 fn deref(&self) -> &T {
509 impl<T> Deref for File<T> {
510 type Target = T;
511 fn deref(&self) -> &T {
541 fn create_file<T: Sync>(&self, name: &CStr, data: &'data T, vtable: &'static FileOps<T>) {
553 pub fn read_only_file<T: Writer + Send + Sync + 'static>(&self, name: &CStr, data: &'data T) {
554 self.create_file(name, data, &T::FILE_OPS)
563 pub fn read_binary_file<T: BinaryWriter + Send + Sync + 'static>(
566 data: &'data T,
568 self.create_file(name, data, &T::FILE_OPS)
582 pub fn read_callback_file<T, F>(&self, name: &CStr, data: &'data T, _f: &'static F)
584 T: Send + Sync + 'static,
585 F: Fn(&T, &mut fmt::Formatter<'_>) -> fmt::Result + Send + Sync,
587 let vtable = <FormatAdapter<T, F> as ReadFile<_>>::FILE_OPS.adapt();
599 pub fn read_write_file<T: Writer + Reader + Send + Sync + 'static>(
602 data: &'data T,
604 let vtable = &<T as ReadWriteFile<_>>::FILE_OPS;
615 pub fn read_write_binary_file<T: BinaryWriter + BinaryReader + Send + Sync + 'static>(
618 data: &'data T,
620 let vtable = &<T as BinaryReadWriteFile<_>>::FILE_OPS;
634 pub fn read_write_callback_file<T, F, W>(
637 data: &'data T,
641 T: Send + Sync + 'static,
642 F: Fn(&T, &mut fmt::Formatter<'_>) -> fmt::Result + Send + Sync,
643 W: Fn(&T, &mut UserSliceReader) -> Result + Send + Sync,
645 let vtable = <WritableAdapter<FormatAdapter<T, F>, W> as ReadWriteFile<_>>::FILE_OPS
658 pub fn write_only_file<T: Reader + Send + Sync + 'static>(&self, name: &CStr, data: &'data T) {
659 let vtable = &<T as WriteFile<_>>::FILE_OPS;
669 pub fn write_binary_file<T: BinaryReader + Send + Sync + 'static>(
672 data: &'data T,
674 self.create_file(name, data, &T::FILE_OPS)
687 pub fn write_only_callback_file<T, W>(&self, name: &CStr, data: &'data T, _w: &'static W)
689 T: Send + Sync + 'static,
690 W: Fn(&T, &mut UserSliceReader) -> Result + Send + Sync,
692 let vtable = &<WritableAdapter<NoWriter<T>, W> as WriteFile<_>>::FILE_OPS