pub struct FileValue { /* private fields */ }
Expand description
Starlark value wrapper for File
.
Implementations§
Source§impl FileValue
impl FileValue
pub fn new(file: File) -> Self
pub fn inner( &self, label: &str, ) -> Result<MutexGuard<'_, FileWrapper>, ValueError>
Trait Implementations§
Source§impl ResourceCollectionContext for FileValue
impl ResourceCollectionContext for FileValue
Source§fn add_collection_context(
&self,
) -> Result<Option<PythonResourceAddCollectionContext>, ValueError>
fn add_collection_context( &self, ) -> Result<Option<PythonResourceAddCollectionContext>, ValueError>
Obtain the
PythonResourceAddCollectionContext
associated with this instance, if available.Source§fn replace_add_collection_context(
&mut self,
context: PythonResourceAddCollectionContext,
) -> Result<Option<PythonResourceAddCollectionContext>, ValueError>
fn replace_add_collection_context( &mut self, context: PythonResourceAddCollectionContext, ) -> Result<Option<PythonResourceAddCollectionContext>, ValueError>
Set the PythonResourceAddCollectionContext value on this instance. Read more
Source§fn as_python_resource(&self) -> Result<PythonResource<'_>, ValueError>
fn as_python_resource(&self) -> Result<PythonResource<'_>, ValueError>
Cast this instance to a
PythonResource
.Source§fn add_collection_context_attrs(&self) -> Vec<&'static str>
fn add_collection_context_attrs(&self) -> Vec<&'static str>
Obtains the Starlark object attributes that are defined by the add collection context.
Source§fn get_attr_add_collection_context(&self, attribute: &str) -> ValueResult
fn get_attr_add_collection_context(&self, attribute: &str) -> ValueResult
Obtain the attribute value for an add collection context. Read more
fn set_attr_add_collection_context( &mut self, attribute: &str, value: Value, ) -> Result<(), ValueError>
Source§impl TypedValue for FileValue
impl TypedValue for FileValue
Source§const TYPE: &'static str = "File"
const TYPE: &'static str = "File"
Return a string describing the type of self, as returned by the type() function.
Source§fn values_for_descendant_check_and_freeze(
&self,
) -> Box<dyn Iterator<Item = Value>>
fn values_for_descendant_check_and_freeze( &self, ) -> Box<dyn Iterator<Item = Value>>
Return a list of values to be used in freeze or descendant check operations. Read more
Source§fn to_str(&self) -> String
fn to_str(&self) -> String
Return a string describing of self, as returned by the str() function.
Source§fn to_repr(&self) -> String
fn to_repr(&self) -> String
Return a string representation of self, as returned by the repr() function.
Source§fn get_attr(&self, attribute: &str) -> ValueResult
fn get_attr(&self, attribute: &str) -> ValueResult
Get an attribute for the current value as would be returned by dotted expression (i.e.
a.attribute
). Read moreSource§fn has_attr(&self, attribute: &str) -> Result<bool, ValueError>
fn has_attr(&self, attribute: &str) -> Result<bool, ValueError>
Return true if an attribute of name
attribute
exists for the current value. Read moreSource§fn set_attr(&mut self, attribute: &str, value: Value) -> Result<(), ValueError>
fn set_attr(&mut self, attribute: &str, value: Value) -> Result<(), ValueError>
Set the attribute named
attribute
of the current value to new_value
(e.g.
a.attribute = new_value
). Read moreSource§fn function_id(&self) -> Option<FunctionId>
fn function_id(&self) -> Option<FunctionId>
Return function id to detect recursion. Read more
Source§fn to_str_impl(&self, buf: &mut String) -> Result<(), Error>
fn to_str_impl(&self, buf: &mut String) -> Result<(), Error>
The implementation of
to_str
, more efficient for nested objectsSource§fn to_repr_impl(&self, buf: &mut String) -> Result<(), Error>
fn to_repr_impl(&self, buf: &mut String) -> Result<(), Error>
The implementation of
to_repr
, more efficient for nested objectsSource§fn to_bool(&self) -> bool
fn to_bool(&self) -> bool
Convert self to a Boolean truth value, as returned by the bool() function.
Source§fn to_int(&self) -> Result<i64, ValueError>
fn to_int(&self) -> Result<i64, ValueError>
Convert self to a integer value, as returned by the int() function if the type is numeric
(not for string).
Source§fn get_hash(&self) -> Result<u64, ValueError>
fn get_hash(&self) -> Result<u64, ValueError>
Return a hash code for self, as returned by the hash() function, or
OperationNotSupported if there is no hash for this value (e.g. list).
Source§fn call(
&self,
_call_stack: &mut CallStack,
_type_values: &TypeValues,
_positional: Vec<Value>,
_named: LinkedHashMap<RcString, Value>,
_args: Option<Value>,
_kwargs: Option<Value>,
) -> Result<Value, ValueError>
fn call( &self, _call_stack: &mut CallStack, _type_values: &TypeValues, _positional: Vec<Value>, _named: LinkedHashMap<RcString, Value>, _args: Option<Value>, _kwargs: Option<Value>, ) -> Result<Value, ValueError>
Perform a call on the object, only meaningfull for function object. Read more
Source§fn at(&self, index: Value) -> Result<Value, ValueError>
fn at(&self, index: Value) -> Result<Value, ValueError>
Perform an array or dictionary indirection. Read more
Source§fn slice(
&self,
_start: Option<Value>,
_stop: Option<Value>,
_stride: Option<Value>,
) -> Result<Value, ValueError>
fn slice( &self, _start: Option<Value>, _stop: Option<Value>, _stride: Option<Value>, ) -> Result<Value, ValueError>
Extract a slice of the underlying object if the object is indexable. The result will be
object between
start
and stop
(both of them are added length() if negative and then
clamped between 0 and length()). stride
indicates the direction. Read moreSource§fn iter(&self) -> Result<&(dyn TypedIterable + 'static), ValueError>
fn iter(&self) -> Result<&(dyn TypedIterable + 'static), ValueError>
Returns an iterable over the value of this container if this value hold an iterable
container.
Source§fn length(&self) -> Result<i64, ValueError>
fn length(&self) -> Result<i64, ValueError>
Returns the length of the value, if this value is a sequence.
Source§fn dir_attr(&self) -> Result<Vec<RcString>, ValueError>
fn dir_attr(&self) -> Result<Vec<RcString>, ValueError>
Return a vector of string listing all attribute of the current value, excluding native
methods.
Source§fn contains(&self, other: &Value) -> Result<bool, ValueError>
fn contains(&self, other: &Value) -> Result<bool, ValueError>
Tell wether
other
is in the current value, if it is a container. Read moreSource§fn plus(&self) -> Result<Self, ValueError>
fn plus(&self) -> Result<Self, ValueError>
Apply the
+
unary operator to the current value. Read moreSource§fn minus(&self) -> Result<Self, ValueError>
fn minus(&self) -> Result<Self, ValueError>
Apply the
-
unary operator to the current value. Read moreSource§fn add(&self, _other: &Self) -> Result<Self, ValueError>
fn add(&self, _other: &Self) -> Result<Self, ValueError>
Add
other
to the current value. Read moreSource§fn sub(&self, _other: &Self) -> Result<Self, ValueError>
fn sub(&self, _other: &Self) -> Result<Self, ValueError>
Substract
other
from the current value. Read moreSource§fn mul(&self, other: Value) -> Result<Value, ValueError>
fn mul(&self, other: Value) -> Result<Value, ValueError>
Multiply the current value with
other
. Read moreSource§fn percent(&self, other: Value) -> Result<Value, ValueError>
fn percent(&self, other: Value) -> Result<Value, ValueError>
Apply the percent operator between the current value and
other
. Read moreSource§fn div(&self, other: Value) -> Result<Value, ValueError>
fn div(&self, other: Value) -> Result<Value, ValueError>
Divide the current value with
other
. division. Read moreAuto Trait Implementations§
impl Freeze for FileValue
impl RefUnwindSafe for FileValue
impl Send for FileValue
impl Sync for FileValue
impl Unpin for FileValue
impl UnwindSafe for FileValue
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self
to use its Binary
implementation when Debug
-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self
to use its Display
implementation when
Debug
-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self
to use its LowerExp
implementation when
Debug
-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self
to use its LowerHex
implementation when
Debug
-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self
to use its Octal
implementation when Debug
-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self
to use its Pointer
implementation when
Debug
-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self
to use its UpperExp
implementation when
Debug
-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self
to use its UpperHex
implementation when
Debug
-formatted.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self
, then passes self.as_ref()
into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self
, then passes self.as_mut()
into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self
, then passes self.deref()
into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B>
of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B>
of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R>
view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R>
view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target
of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target
of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap()
only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref()
only in debug builds, and is erased in release
builds.