#Guarantee return type isn't const

1 messages · Page 1 of 1 (latest)

twin prairie
#

I'm tired of having to spam @constCast() everywhere because the return type of a function is assumed to be const. Is there a way to guarantee the return type is mutable and not const?

odd parcel
#

what's an example of a @constCast you're using?

#

i don't quite understand your question. types, and therefore return types, don't have an inherent constness.

odd parcel
#

what's the definition of widgets.Container?

twin prairie
odd parcel
#

ah you're talking about temporary values

#

you should just save it in a local var

twin prairie
#
pub const NestedFrame = struct {
    x: u32 = 0,
    y: u32 = 0,
    x_size: u32 = 0,
    y_size: u32 = 0,
    id: u64 = 0,
    children: std.ArrayList(NestedFrame),
    callbacks: FrameCallbacks,
};
twin prairie
odd parcel
twin prairie
remote yarrow
odd parcel