I need to use TikZ to draw two horizontally-spaced nodes, and an arrow between them, labelled by some text. But the arrow has to be exactly the right length to fit the text, and this will be part of a macro which could be called with text of highly variable length. The problem is that I don't know the width of the text until I've drawn the arrow and labelled it, but I have to place the nodes before I can draw the arrow. TikZ must have a solution for this - any ideas?
Edit: the intention is for the arrow to reach right up to both nodes, so that it is clearly going 'from' the first node to the second, and for the arrow to only be just long enough for the text to fit as a label. So, the more text, the longer the arrow, and the further apart the nodes; the less text, the closer the nodes become.