- [1, 2]</code></pre><p>Because setting <code>x[1] .= 1</code> creates a <code>Bar</code> struct first, broadcasted assignment modifies this new materialized struct rather than the StructArray <code>x</code>. Note, however, that <code>x[1] = x[1] .= 1</code> works, since it assigns the modified materialized struct to the first entry of <code>x</code>.</p><h2 id="Mutability"><a class="docs-heading-anchor" href="#Mutability">Mutability</a><a id="Mutability-1"></a><a class="docs-heading-anchor-permalink" href="#Mutability" title="Permalink"></a></h2><p>The component arrays of a StructArray can be modified in-place mutable even if the <code>struct</code> element type of the overall array is immutable. A StructArray with immutable elements will in many cases behave identically to (but be more efficient than) a StructArray with mutable elements.</p></article><nav class="docs-footer"><a class="docs-footer-prevpage" href="../examples/">« Example usage</a><a class="docs-footer-nextpage" href="../advanced/">Advanced techniques »</a><div class="flexbox-break"></div><p class="footer-message">Powered by <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> and the <a href="https://julialang.org/">Julia Programming Language</a>.</p></nav></div><div class="modal" id="documenter-settings"><div class="modal-background"></div><div class="modal-card"><header class="modal-card-head"><p class="modal-card-title">Settings</p><button class="delete"></button></header><section class="modal-card-body"><p><label class="label">Theme</label><div class="select"><select id="documenter-themepicker"><option value="documenter-light">documenter-light</option><option value="documenter-dark">documenter-dark</option></select></div></p><hr/><p>This document was generated with <a href="https://github.com/JuliaDocs/Documenter.jl">Documenter.jl</a> version 0.27.25 on <span class="colophon-date" title="Friday 1 November 2024 08:10">Friday 1 November 2024</span>. Using Julia version 1.11.1.</p></section><footer class="modal-card-foot"></footer></div></div></div></body></html>
0 commit comments