nullable reference inlining
This commit is contained in:
		
							parent
							
								
									455ffd6063
								
							
						
					
					
						commit
						2f2ba19f2c
					
				@ -19,7 +19,8 @@ class BinaryTree(RecursiveMentionable, Generic[TreeKeyType]):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    def __init__(
 | 
					    def __init__(
 | 
				
			||||||
            self,
 | 
					            self,
 | 
				
			||||||
            treel: NullableReference['BinaryTree[TreeKeyType]'], treer: NullableReference['BinaryTree[TreeKeyType]'],
 | 
					            treel: NullableReference['BinaryTree[TreeKeyType]'],
 | 
				
			||||||
 | 
					            treer: NullableReference['BinaryTree[TreeKeyType]'],
 | 
				
			||||||
            key: HashPoint[TreeKeyType]
 | 
					            key: HashPoint[TreeKeyType]
 | 
				
			||||||
    ):
 | 
					    ):
 | 
				
			||||||
        assert isinstance(treel, NullableReference)
 | 
					        assert isinstance(treel, NullableReference)
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,7 @@
 | 
				
			|||||||
from typing import Generic, Iterable, TypeVar
 | 
					from typing import Generic, Iterable, Optional, TypeVar
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from rainbowadn.core import *
 | 
					from rainbowadn.core import *
 | 
				
			||||||
 | 
					from rainbowadn.inlining import *
 | 
				
			||||||
from .notnull import *
 | 
					from .notnull import *
 | 
				
			||||||
from .null import *
 | 
					from .null import *
 | 
				
			||||||
from .nullable import *
 | 
					from .nullable import *
 | 
				
			||||||
@ -69,11 +70,14 @@ class NullableReference(RecursiveMentionable, Generic[Referenced]):
 | 
				
			|||||||
        return await self.hashpoint().resolve()
 | 
					        return await self.hashpoint().resolve()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class NullableReferenceFactory(RainbowFactory[NullableReference[Referenced]], Generic[Referenced]):
 | 
					class NullableReferenceFactory(Inlining[NullableReference[Referenced]], Generic[Referenced]):
 | 
				
			||||||
    def __init__(self, factory: RainbowFactory[Referenced]):
 | 
					    def __init__(self, factory: RainbowFactory[Referenced]):
 | 
				
			||||||
        assert isinstance(factory, RainbowFactory)
 | 
					        assert isinstance(factory, RainbowFactory)
 | 
				
			||||||
        self.factory = factory
 | 
					        self.factory = factory
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def size(self) -> Optional[int]:
 | 
				
			||||||
 | 
					        return HashPoint.HASH_LENGTH
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def from_bytes(self, source: bytes, resolver: HashResolver) -> NullableReference[Referenced]:
 | 
					    def from_bytes(self, source: bytes, resolver: HashResolver) -> NullableReference[Referenced]:
 | 
				
			||||||
        assert isinstance(source, bytes)
 | 
					        assert isinstance(source, bytes)
 | 
				
			||||||
        assert isinstance(resolver, HashResolver)
 | 
					        assert isinstance(resolver, HashResolver)
 | 
				
			||||||
@ -81,7 +85,7 @@ class NullableReferenceFactory(RainbowFactory[NullableReference[Referenced]], Ge
 | 
				
			|||||||
            return NullableReference(Null(), self.factory)
 | 
					            return NullableReference(Null(), self.factory)
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            return NullableReference.of(
 | 
					            return NullableReference.of(
 | 
				
			||||||
                ResolverOrigin(self.factory, source, resolver).hash_point()
 | 
					                ResolverMetaOrigin(resolver).hash_point(self.factory, source)
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def loose(self) -> RainbowFactory[NullableReference[Referenced]]:
 | 
					    def loose(self) -> RainbowFactory[NullableReference[Referenced]]:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user